Code dom and Attributes

  • Thread starter Thread starter Wayne
  • Start date Start date
W

Wayne

I need to add some attributes and look at existing attributes to a property.
Not the private/public stuff, but rather something like:

System.Xml.Serialization.XmlElementAttribute

What should I look at for doing this?

Thanks
Wayne
 
Wayne,

I would check for an Attributes property on the CodeDom elements that
you are adding. It should return a collection which will allow you to add
CodeAttributeDeclaration instances which would be the declarations for the
attributes.

Hope this helps.
 
Thanks for Nicholas's quick reponse!

Hi Wayne,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to add some customized
attributes to codedom member. If there is any misunderstanding, please feel
free to let me know.

As far as I know, the CodeTypeMember.CustomAttributes property can do this
for us. You can try to create a CodeAttributeDeclaration object and then
add it to the CustomAttributes collection. For more information, please
check the following links:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemCodeDomCodeAttributeDeclarationClassTopic.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemcodedomcodetypememberclasscustomattributestopic.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Worked great as usual, thanks. Sorry about the delay, VSLIVE and work got
caught in the middle of play time :)

Wayne
 
Hi Wayne,

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top