nick5454

when I create my property created it is declared like this

public virtual PropName { ... }

But, I don't want the virtual modifier specified. How do I keep this from being specified

Please help,

My code segment is below.

// Generate a property
CodeMemberProperty prop = new CodeMemberProperty();
prop.Attributes = MemberAttributes.Public;
prop.Type = new CodeTypeReference(typeof(string));
prop.Name = propertyName;
prop.HasGet = true;
prop.GetStatements.Add(new CodeSnippetExpression("return " + nameDeclaration));
prop.HasSet = true;
prop.SetStatements.Add(new CodeSnippetExpression(nameDeclaration + " = value"));



Re: .NET Base Class Library CodeDOM setting virtual to my properties

MS Johan Stenberg

Try:

Code Snippet

prop.Attributes = MemberAttributes.Public | MemberAttributes.Final;

Best regards,

Johan Stenberg






Re: .NET Base Class Library CodeDOM setting virtual to my properties

nick5454

Thanks, that worked perfect