Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

codedom member field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jarlaxle - 27 Mar 2008 17:40 GMT
Does anyone know why the codedom puts a '@' next to the type when generating
a field?  does anyone know how to get rid of it?...

CodeMemberField member = new CodeMemberField("bool" , "_boolfield");
classtype.Members.Add(member);

creates...

private @bool _boolfield;

Thanks.
Jon Skeet [C# MVP] - 27 Mar 2008 17:42 GMT
> Does anyone know why the codedom puts a '@' next to the type when generating
> a field?  does anyone know how to get rid of it?...
[quoted text clipped - 5 lines]
>
> private @bool _boolfield;

That's to avoid it being confused with the keyword "bool" in C#.

Basically it thinks you're trying to refer to a type called "bool"
instead of System.Boolean.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

Jarlaxle - 27 Mar 2008 18:16 GMT
is there a way to tell it not to do that?

I have some types read in as strings from a file.  the types could be
user-defined or primitive types.

i just want it to use whatever string i tell it to.

> > Does anyone know why the codedom puts a '@' next to the type when generating
> > a field?  does anyone know how to get rid of it?...
[quoted text clipped - 10 lines]
> Basically it thinks you're trying to refer to a type called "bool"
> instead of System.Boolean.
Jon Skeet [C# MVP] - 27 Mar 2008 18:25 GMT
> is there a way to tell it not to do that?
>
> I have some types read in as strings from a file.  the types could be
> user-defined or primitive types.
>
> i just want it to use whatever string i tell it to.

I don't know, to be honest. You might want to just have a map from the
primitive names to the CLR types.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.