开发者

CodeDOM question

开发者 https://www.devze.com 2023-03-28 00:37 出处:网络
How to create: internal struct StructNam开发者_如何学运维e { public static byte[] Code = new byte[]

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

精彩评论

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