CodeDom: more than one Attribute for a CodeMemberMethod

  • Thread starter Thread starter Kai Huener
  • Start date Start date
K

Kai Huener

ello,

I try to make a function, adding automatically all functions to a new class
which are necessary because of implemented Interfaces or inherited, abstract
classes. In the last case, it is necessary to have two attributes in front
of the function, like protected override void Foo(){}. And now my question:

1.: I can't find the Attribute "protectd" in the enum
"System.CodeDom.MemberAttributes". Why? Is it the wrong place to look?

2.: Why isn't it possible to add more than one Attribute to a new Method? I
can set the Property "System.CodeDom.CodeMemberMethod.Attributes" only to
one Attribute. How can I declare a new method to "public static" or
"protected override?.

Every Hint can be helpful for me, even a possibility to solve my problem in
a different way, perhaps there is a better way to success?

Best Regards,
Kai Hüner
 
Kai Huener said:
I try to make a function, adding automatically all functions to a new class
which are necessary because of implemented Interfaces or inherited, abstract
classes. In the last case, it is necessary to have two attributes in front
of the function, like protected override void Foo(){}. And now my question:

1.: I can't find the Attribute "protectd" in the enum
"System.CodeDom.MemberAttributes". Why? Is it the wrong place to look?

Nope, it's just that it's called Family as far as the framework is
concerned.
2.: Why isn't it possible to add more than one Attribute to a new Method? I
can set the Property "System.CodeDom.CodeMemberMethod.Attributes" only to
one Attribute. How can I declare a new method to "public static" or
"protected override?.

It's a bit flag - just set it to
MemberAttributes.Public | MemberAttributes.Static
or
MemberAttributes.Family | MemberAttributes.Override

(for example).
 
Hi Jon,

Thank you for the fast help, your post solved both problems :-)

Best Regards,
Kai
 
Back
Top