.NET Discussion

.NET Issues, Problems, Code Samples, and Fixes

ASP.NET: How To Name A Variable Or Property Using .NET’s “Reserved” Words

Let’s say you want to give your class a boolean property named Error that gets turned on or off if something goes awry in your code. You would think that you can’t do this because the word “Error” is reserved by .NET. However, there is a way. All you have to do is put square brackets around the word! For instance:

Public Property [Error]() As Boolean

Easy, no?

December 13, 2007 Posted by Some.Net(Guy) | ASP.NET, Tips & Tricks | | 2 Comments