tags:

views:

277

answers:

4

Where can I get a list of reserved keywords in C#?

+1  A: 

List here

PatrikAkerstrand
4 secs faster, but that's the VS7.1 version :p
dtb
I bet its compiler specific.
Havenard
@Havenard: There aren't a whole lot of C# compilers out there to begin with…
htw
+1  A: 

The C# Language Reference on MSDN would be a good start.

jscharf
+9  A: 

From Microsoft's website:

Microsoft Visual Studio 2008/.NET Framework 3.5

  • abstract
  • as
  • base
  • bool
  • break
  • byte
  • case
  • catch
  • char
  • checked
  • class
  • const
  • continue
  • decimal
  • default
  • delegate
  • do
  • double
  • event
  • explicit
  • extern
  • false
  • finally
  • fixed
  • float
  • for
  • foreach
  • goto
  • if
  • implicit
  • in
  • int
  • interface
  • internal
  • is
  • lock
  • new
  • null
  • object
  • operator
  • out
  • override
  • params
  • private
  • protected
  • public
  • readonly
  • ref
  • return
  • sbyte
  • sealed
  • short
  • sizeof
  • stackalloc
  • struct
  • switch
  • this
  • throw
  • true
  • try
  • typeof
  • uint
  • ulong
  • unchecked
  • unsafe
  • ushort
  • using
  • virtual
  • void
  • volatile
  • while
kolistivra
You forgot `__makeref`, `__reftype`, `__refvalue`, and `__arglist` :)
280Z28
So add them then. You have edit privileges.
Geoffrey Chetwood
-1, a list like this should mention the version.
Henk Holterman
@Henk: So why didn't you add it then?
Geoffrey Chetwood
+2  A: 

Note that if you need the keywords because you are automatically generating C# code to be compiled, you can use, for example, @new as a variable identifier even though new is a reserved word.

I'm having trouble finding the specific MSDN link explaining that, but csharp-online has this page on it.

Mark Rushakoff