tags:

views:

100

answers:

2
public struct Char
{
 public const char MaxValue = (char)0xffff;
 public const char MinValue = '\0';
}

Why don't make this fields to be static? What for it's always allocating additional memory for each char while this two values are permanent?

Edit: I don't know how I could forget about been static implicitly!

+13  A: 

const fields are implicity static. From section 10.4 of the spec:

Even though constants are considered static members, a constant-declaration neither requires nor allows a static modifier. It is an error for the same modifier to appear multiple times in a constant declaration.

Jon Skeet
+10  A: 

Because they are static.

Const fields are static implicitly.

Richard