GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 6 of 436    Print  

Why do I get a syntax error when trying to declare a variable called checked?

The word checked is a keyword in C#.


  
Total Answers and Comments: 3 Last Update: April 05, 2008   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Vikas Yadav
 
Reason is checked is a keyword in C#,but if u want to keyword as an identifier use @ with it.e.g int @checked=3;
This works with all the keywords,but it is recommended to avoid it.

Above answer was rated as good by the following members:
velsankar, chintan.desai
January 09, 2006 09:25:07   #1  
sahu Member Since: December 2005   Contribution: 323    

RE: Why do I...

Ans:

Yes

The word checked is a keyword in C#.


 
Is this answer useful? Yes | No
October 04, 2007 00:35:48   #2  
cmakarla Member Since: October 2007   Contribution: 1    

RE: Why do I...
Checked and UnChecked is keyword in C# used to control the overflow-checking contex for integral type arithemetic operations and conversions. it can be used as an operator or a statement.

 
Is this answer useful? Yes | No
April 05, 2008 03:49:33   #3  
Vikas Yadav Member Since: April 2008   Contribution: 15    

RE: Why do I get a syntax error when trying to declare a variable called checked?
Reason is checked is a keyword in C# but if u want to keyword as an identifier use @ with it.e.g int @checked 3;
This works with all the keywords but it is recommended to avoid it.

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape