What will happen if you declare a variable named "checked" with any data type?

 Posted by Virendradugar on 12/15/2009 | Category: C# Interview questions | Views: 5772
Answer:

Compiler will throw an error as checked is a keyword in C# So It cannot be used as variable name. Checked keyword is used to check the overflow arithmetic checking.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Caveatashish on: 12/16/2009
A small reminder here, the same will work fine in vb.net but not in C#.

here is the sample code run fine in vb.net but not in c#

Dim checked As Integer
checked = 10
MsgBox(checked)


Login to post response