CreateObject Example for C#

private void TestCreateObject()
{
   //CreateObject Example
   //this sample will dynamically create a LEAD Dicom Kernel
   //object and use it to unlock DICOM support
   LTDicomKernelLib.LEADDicomFactory factory = new LTDicomKernelLib.LEADDicomFactory();
   LTDicomKernelLib.LEADDicomKernel kernel = null;
   string szLic = null;
   szLic = "LEADTOOLS OCX Copyright (c) 1991-2005 LEAD Technologies, Inc.";
   kernel = (LTDicomKernelLib.LEADDicomKernel)factory.CreateObject("LEADDicomKernel.LEADDicomKernel", szLic);
   kernel.EnableMethodErrors = false;
   kernel.UnlockSupport((short)LTDicomKernelLib.DicomSupportLockConstants.L_SUPPORT_DICOM, "MyUnlockKey");
   if (kernel.IsSupportLocked((short)LTDicomKernelLib.DicomSupportLockConstants.L_SUPPORT_DICOM))
      MessageBox.Show("Unlock Failed!");
}