Generating barcodes in C# using BarCode Generator SDK is easy – use the following source code sample.

C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

using Bytescout.BarCode;

namespace Sample
{
   class Program
   {
       static void Main(string[] args)
       {
           // Create new barcode object for barcodes generating purposes
           Barcode barcode = new Barcode();

           // Set symbology for barcode generation (you may generate UPCA, Code 39, Code 128, QR Code, Datamatrix, EAN13 and lot of other barcodes)
           barcode.Symbology = SymbologyType.UPCA;

           // Set barcode value to encode into generated bar code image
           barcode.Value = "12345678901";

           // Save barcode to image
           barcode.SaveImage("result.png");

           // Show image in the default image viewer
           Process.Start("result.png");
       }
   }
}