public static void Run()
{
// ExStart:OptionalExceptionMessageWith1DBarCode
// Instantiate BarCodeBuilder object
BarCodeBuilder builder = new BarCodeBuilder("348503498549085409", EncodeTypes.EAN13);
try
{
// Error message will not been thrown in case of false, default value is also false and Get barcode image
builder.ThrowExceptionWhenCodeTextIncorrect = true;
Bitmap bitmap = builder.GenerateBarCodeImage();
}
catch (Exception ex)
{
Console.WriteLine("Exception must be thrown, {0}", ex.Message);
}
// ExEnd:OptionalExceptionMessageWith1DBarCode
}
}