MemberAttributes for CodeConstructor

K

kishore

hi
I am trying to dynamically generate a static constructor using
CodeDOM. However even though i set the MemberAttributes to static, it
generates a constructor with no attributes. not sure how to do. Any
help please.

Here is my code
CodeConstructor staticConstructor = new
CodeConstructor();
staticConstructor.Attributes |=
MemberAttributes.Static;
newClass.Members.Add(staticConstructor);


This is generating a constructor as below:

MyClass()
{

}

Its not appending the "static" keyword with the constructor. What am i
missing?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top