开发者

MonoCecil Type.IsCOMObject equivalent?

I'd like to make a method that takes a TypeDefinition and tells me if it represents a COM object. The method should also work in the .NET 4.0 "Embedded COM Interop Types" case.

Any开发者_Go百科 idea how I could do that?


Maybe something like this:

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

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

From official reference here: Common Language Infrastructure (CLI). Partition II: Metadata Definition and Semantics.

10.1 Type header (ClassHeader):

Implementation-specific (Microsoft)

The above grammar also includes ClassAttr ::= import to indicate that the type is imported from a COM type library.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜