2012-09-16 3 views

답변

3

ClassInterfaceAttribute은 클래스가 COM 발신자에게 표시되는 정도를 선언하는 데 사용됩니다. 즉, 클래스가 COM 세계의 클래스를 사용하려고 할 때 멋지게 재생되는 경우에 사용됩니다. 세 가지 옵션이 있는데 ClassInterfaceType 열거 형에 포함되어 있으며 ClassInterfaceAttribute의 과부하 매개 변수로 지정할 수 있습니다. 다음은 MSDN에서, 그리고 아래 InterfaceType의 다른 선택할 수있는 세 가지 클래스 선언, 각각의 예입니다

// This one will not be visible to COM clients. 
[ClassInterface(ClassInterfaceType.None)] 
public class MyClass1 
{ 

} 

// This one will provide an interface for COM clients, 
// but only when/if one is requested of it. 
[ClassInterface(ClassInterfaceType.AutoDispatch)] 
public class MyClass2 
{ 

} 

// This one will, immediately upon instantiation, 
// automatically include an interface for COM clients. 
[ClassInterface(ClassInterfaceType.AutoDual)] 
public class MyClass3 
{ 

} 
: 다음은 ClassInterfaceAttribute의 사용을 보여

ClassInterfaceAttribute on MSDN

ClassInterfaceType on MSDN

관련 문제