本文整理匯總了C#中System.Runtime.InteropServices.TypeLibConverter.ConvertAssemblyToTypeLib方法的典型用法代碼示例。如果您正苦於以下問題:C# TypeLibConverter.ConvertAssemblyToTypeLib方法的具體用法?C# TypeLibConverter.ConvertAssemblyToTypeLib怎麽用?C# TypeLibConverter.ConvertAssemblyToTypeLib使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。
在下文中一共展示了TypeLibConverter.ConvertAssemblyToTypeLib方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GuidAttribute
//引入命名空間
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
[ComImport,
GuidAttribute( "00020406-0000-0000-C000-000000000046" ),
InterfaceTypeAttribute( ComInterfaceType.InterfaceIsIUnknown ),
ComVisible( false )]
public interface UCOMICreateITypeLib
{
void CreateTypeInfo();
void SetName();
void SetVersion();
void SetGuid();
void SetDocString();
void SetHelpFileName();
void SetHelpContext();
void SetLcid();
void SetLibFlags();
void SaveAllChanges();
}
public class App
{
public static void Main()
{
Assembly asm = Assembly.LoadFrom( "MyAssembly.dll" );
TypeLibConverter converter = new TypeLibConverter();
ConversionEventHandler eventHandler = new ConversionEventHandler();
UCOMICreateITypeLib typeLib = (UCOMICreateITypeLib)converter.ConvertAssemblyToTypeLib( asm, "MyTypeLib.dll", 0, eventHandler );
typeLib.SaveAllChanges();
}
}
public class ConversionEventHandler : ITypeLibExporterNotifySink
{
public void ReportEvent( ExporterEventKind eventKind, int eventCode, string eventMsg )
{
// Handle the warning event here.
}
public Object ResolveRef( Assembly asm )
{
// Resolve the reference here and return a correct type library.
return null;
}
}
開發者ID:.NET開發者,項目名稱:System.Runtime.InteropServices,代碼行數:50,代碼來源:TypeLibConverter.ConvertAssemblyToTypeLib