• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 383
  • Last Modified:

What dos this syntax mean: Default = f.@default == "yes"

Default is a boolean but I am confused by the @ in front of "default".

Is that just the variable name?

It follows this line:
        [System.Xml.Serialization.XmlAttributeAttribute()]

Thanks.
0
newbieweb
Asked:
newbieweb
2 Solutions
 
HainKurtSr. System AnalystCommented:
Default = f.@default == "yes"

-->

Default = (f.@default == "yes")

-->

if (f.@default == "yes") then Default = true else Default=false
0
 
newbiewebSr. Software EngineerAuthor Commented:
Yes, I understand C#.

I was asking about the @ in front of default.
0
 
Bill NolanOwner, Lead Technology ProgrammerCommented:
It allows you to use a reserved word.  E.g., the following won't compile:

int default = 1;
0
 
Jacques Bourgeois (James Burger)PresidentCommented:
default is a reserved word in C#.

Adding @ in front of a property or method name enables you to use a word that would not be usable otherwise.

Having a property called default is not permitted, because it is a reserved word, but @default is accepted.

Search for "C# Keywords" in the documentation and give a look at the first paragraph.
0
 
newbiewebSr. Software EngineerAuthor Commented:
Thanks. I now remember I used to know that :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now