Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have question what does it mean using @ as prefix for a variable Name or in a method parameter name as like below. as you can see i have used same variable name with and without @ so what was the difference. Hope for you guys it will be a basic question which i don't know the difference.

C#
public static string ReplaceSpecialCharacters(this string @sText)
        {
            @sText.Replace("& lt; ", "<");
            @sText.Replace("& gt;", ">");
            sText.Replace("& amp;", "&");
            @sText.Replace("& quot;", "\"");
            sText.Replace("& apos;", "\'");
            return @sText;
        }
Posted
Updated 18-Jun-14 21:15pm
v2
Comments
Sanjay K. Gupta 19-Jun-14 3:25am    
Nothing.
Gold$Coin 19-Jun-14 5:06am    
?

1 solution

The @ symbol allows you to use a reserved keyword for a variable name. Such as @class.
 
Share this answer
 
Comments
Gold$Coin 19-Jun-14 5:06am    
you mean as like using ref key word in C#?
if so as you can see that i have used @ only in some of the variable usage all results in same result. what would be the difference?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900