By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,671 Members | 1,393 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,671 IT Pros & Developers. It's quick & easy.

CodeDom Protected AND Override, more then one Attribute, how?

P: n/a
Here is the CodeDom code for the standard Dispose method of a windows form application.
The problem I have is with the Attributes property, it isn't a collection so only one attribute can be assigned to it.
I would like to set the attributes protected AND override but I can only set one, if I set the other it cancels out the previous.
Does anyone know how to do this?

CodeMemberMethod newMethod = new CodeMemberMethod();

newMethod.Attributes=MemberAttributes.Override; // THIS IS THE PROBLEM

newMethod.Parameters.Add(new CodeParameterDeclarationExpression(Type.GetType("S ystem.Boolean"),"disposing"));
CodeStatement[] someExpressions = new CodeStatement[0];
CodeConditionStatement newIf = new CodeConditionStatement(new CodeSnippetExpression("disposing"), someExpressions);
someExpressions = new CodeStatement[0];
CodeConditionStatement secondIf = new CodeConditionStatement(new CodeSnippetExpression("components != null"), someExpressions);
secondIf.TrueStatements.Add(new CodeSnippetStatement("components.Dispose();"));
CodeSnippetStatement aStatement = new CodeSnippetStatement("base.Dispose(disposing);");
newMethod.Name = "Dispose";
Nov 15 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
I got it

newMethod.Attributes=MemberAttributes.Override|Mem berAttributes.Family
Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.