using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleLearning
{
class Program
{
static void Main(string[] args)
{
Console.SetWindowSize(80, 40);
Console.SetBufferSize(160, 80);
enum Letters {A=65,B,C,D,E,F,H,I,J,K};
int n = 0;
do
{
for (int i = 0; i < 10; i++)
{
Console.CursorLeft = i;
Console.CursorTop = i;
// Console.Write((char)Letters]);
}
} while (n == 0);
}
}
}
Everyting was working fine until I added to line with the enum.
Accoring to MSDN an enum is delared like this:
enum Days {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri};
I really have no idea how to fix this, any help appreciated.
Thanks.
New to C#, probly dumb problem ahead:
Here's my code:
Quote:Original post by Alpha_ProgDes
you should be able to declare in or outside of main() shouldn't you?
No, 'enum' is a type declaration which cannot be done inside any method.
Thank you, what is a type and what is not is still confusing to me.
Now I have what I wanted.
Where is the help page for how to use code tags etc?
Now I have what I wanted.
for (int i = 0; i < 10; i++)
{
Console.CursorLeft = i;
Console.CursorTop = i;
Console.Write(Letters.A+i);
}
Where is the help page for how to use code tags etc?
Quote:Original post by ThoughtCriminal
what is a type
Everything that you can put in front of the name of a variable in a declaration is a type.
Quote:Original post by ThoughtCriminal
Where is the help page for how to use code tags etc?
See that little link near the top of the page titled "faq"? It includes a section describing allowed tags. In your case, just use lower case, instead of upper case. Or alternatively, use "source" instead of "code" to get a nice scrollable box.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement