dimanche 30 juillet 2017

(C# 'Random' is a namespace but is used like a variable) I don't understand why

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.




Aucun commentaire:

Enregistrer un commentaire