Resereved word used as a Class memberName

As we know we can't used the reserved word, but if you really want used, let's with me.
 
I have used console application. I make one method and this method Name is @String. if we are directly used string 
  1. public void @string()      
  2.       {      
  3.         Console.WriteLine("String is a reserved word");      
  4.       }     
 Call here above method.
  1. static void Main(string[] args)    
  2. {    
  3.     Program p = new Program();    
  4.     p.@string();    
  5.     
  6. }   
Note:- When we are used the Reserved keyword then must be prefix '@' on the Reserved word. 
 
Make another method and name is @name. 
  1. public void @Name()  
  2.         {  
  3.   
  4.                       Console.WriteLine("@name Not a reserved keyword ");  
  5.         } 
 Call here above method
  1. static void Main(string[] args)      
  2. {      
  3.     Program p = new Program();      
  4.     p.Name();      
  5.       
  6. }     
 I hope it's very useful for who's want set the Reserved name set on the Method name. 
 
 
 
 
 
Ebook Download
View all
Learn
View all