Why can I call TheFakeStaticClass.FooConst as static when it is not declared static?
Are constant fields converted to static fields at compile time? (I understand that you cannot change const and therefore you only need βone instance.β I used a lot of constants earlier than Math.PI , but I never thought about it before, and now I do it, and now I curious.
namespace ConstTest { class Program { class TheFakeStaticClass { public const string FooConst = "IAmAConst"; } class TheRealStaticClass { public static string FooStatic = "IAmStatic"; } static void Main() { var fc = TheFakeStaticClass.FooConst;
source share