Reputation: 43
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome To The Random.");
System.Threading.Thread.Sleep(1000);
choosing:
Console.WriteLine("Roll Standard Dice (D), Flip a Coin (2), 8-Ball (8), or Random Number 1-10 (R)");
ConsoleKeyInfo result = Console.ReadKey();
if ((result.KeyChar == 'D') || (result.KeyChar == 'd'))
{
Console.WriteLine("Standard Dice Has been chosen, do you want to continue? Y/N");
ConsoleKeyInfo RSD = Console.ReadKey();
if ((RSD.KeyChar == 'Y') || (RSD.KeyChar == 'y'))
{
Console.Write("Rolling");
Console.Write(".");
Console.Write(".");
Console.Write(".");
}
else if ((RSD.KeyChar == 'N') || (RSD.KeyChar == 'n'))
{
Console.Clear();
goto choosing;
}
}
else if ((result.KeyChar == '2'))
{
Console.WriteLine("I wont do anything");
}
else if ((result.KeyChar == '8'))
{
}
else if ((result.KeyChar == 'R') || (result.KeyChar == 'r'))
{
}
*Random* rnd = new *Random*();
}
}
The parts in asterix are the part where it is a red line and it says Random is a namespace but it's used like a variable. The Random thing normally works but I'm not sure why it isn't working now if you could please help me that would be appreciated.
Upvotes: 1
Views: 2116
Reputation: 15933
You're declaring a type with the same name as the namespace it's in. Don't do that. Change you namespace to some other name than Random
Some further instructions on Do not name a class the same as its namespace, Part One
Upvotes: 2
Reputation: 222722
Your project's namespace is also Random, change it to some other name,
namespace Random
to
namespace Sample
Upvotes: 8