G
gwainguard
Hello, would you please consider the following small piece of code.
using System;
class Constants
{
public const int A = B;
public const int B = 2;
}
class Test
{
static void Main()
{
Console.WriteLine("{0}", A);
}
}
I am getting an error that 'A does not exist in the current context'
for Console.WriteLine(...A) above.
I had thought that by declaring A as a PUBLIC field of the Constants
class that it would be accessable by my Test class.
Can someone please explain the error that I have made.
Indebted for your time,
GM.
using System;
class Constants
{
public const int A = B;
public const int B = 2;
}
class Test
{
static void Main()
{
Console.WriteLine("{0}", A);
}
}
I am getting an error that 'A does not exist in the current context'
for Console.WriteLine(...A) above.
I had thought that by declaring A as a PUBLIC field of the Constants
class that it would be accessable by my Test class.
Can someone please explain the error that I have made.
Indebted for your time,
GM.