473,386 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Code dom and Attributes

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
Nov 16 '05 #1
4 1356
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Wayne" <Me******@community.nospam> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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

Nov 16 '05 #2
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/de...us/cpref/html/
frlrfSystemCodeDomCodeAttributeDeclarationClassTop ic.asp

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemcodedomcodetypememberclasscustomattribu testopic.asp

HTH.

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

Nov 16 '05 #3
Worked great as usual, thanks. Sorry about the delay, VSLIVE and work got
caught in the middle of play time :)

Wayne

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:MO**************@cpmsftngxa10.phx.gbl...
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/de...us/cpref/html/ frlrfSystemCodeDomCodeAttributeDeclarationClassTop ic.asp

http://msdn.microsoft.com/library/de...us/cpref/html/ frlrfsystemcodedomcodetypememberclasscustomattribu testopic.asp

HTH.

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

Nov 16 '05 #4
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."

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: qualitynice | last post by:
HELP :-)... I'm creating an embedded activex object in an asp.net page using the HtmlGenericControl class. I'm doing this because when I tried to embed it directly in the aspx page, it stopped...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
6
by: Just Me | last post by:
Any ideas on this. I am trying to loop through an xml document to remove attributes, but Im having so much trouble, any help is appreciated //THIS IS THE EXCEPTION ( SEE CODE LINE WHERE FAILURE...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.