2011-04-21 6 views
0

TypeDefinition을 사용하고 COM 개체를 나타내는 경우 알려주는 메서드를 만들고 싶습니다. 이 메서드는 .NET 4.0 "Embedded COM Interop Types"에서도 작동해야합니다.MonoCecil Type.IsCOMObject와 동등한 제품입니까?

내가 어떻게 할 수 있는지 알기 원하십니까? 이 같은

답변

3

아마 뭔가 : 여기 공식 참조에서

public static bool IsCOMObject(TypeDefinition type) 
    { 
     if (type == null) 
      throw new ArgumentNullException("type"); 

     return (type.Attributes & TypeAttributes.Import) == TypeAttributes.Import; 
    } 

: Common Language Infrastructure (CLI). Partition II: Metadata Definition and Semantics.

10.1 Type 헤더 (ClassHeader) :

구현 고유의 (마이크로 소프트)

위의 문법도 포함 ClassAttr :: = 가져 오기는 유형이 COM 형식에서 가져 있음을 나타냅니다 라이브러리.

+0

테스트 한 결과 .NET 4.0 "Embedded COM Interop Types"와 일반 PIA COM 유형 모두에서 작동했습니다. 감사!! –