开发者

CodeDOM question

How to create:

internal struct StructNam开发者_如何学运维e
{
    public static byte[] Code = new byte[] 
    { 
     0, 0, 0, 0 
    };
}

in CodeDOM?

Thank you.


With out writing the code this should send you in the right direction.

Using CodeTypeDeclaration which you would use for making Classes etc has a IsStruct property set that to true.

Where type is = CodeTypeDeclaration.

That will then enable you to build the first part to make it internal you need to do

type.Attributes = MemberAttributes.FamilyAndAssembly; this will make it Internal.

You can then use type.Members.Add() and build up a member to do the rest in the standard way.

Thanks Alex

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜