Results 1 to 3 of 3

Thread: Any C# programmers here? (Should be simple..)

  1. #1
    Senior Member
    Join Date
    Aug 2004
    Location
    W Yorkshire
    Posts
    5,691
    Thanks
    85
    Thanked
    15 times in 13 posts
    • XA04's system
      • Motherboard:
      • MSI X570-A Pro
      • CPU:
      • AMD Ryzen 5 3600
      • Memory:
      • Corsair 2x 8gb DDR 4 3200
      • Storage:
      • 1TB Serpent M.2 SSD & 4TB HDD
      • Graphics card(s):
      • Palit RTX 2060
      • PSU:
      • Antec Truepower 650W
      • Case:
      • Fractcal Meshify C
      • Operating System:
      • Windows 10
      • Monitor(s):
      • iiyama 34" Curved UWQHD
      • Internet:
      • Virgin 100mb Fibre

    Any C# programmers here? (Should be simple..)

    Trying to create a random number between 0 and 10 using the following code:
    Code:
    using System;
    class Random
    {
    	public static void Main()
    	{
            Random rand = new Random();
            Console.WriteLine(rand.Next(0,10));
    	}
    }
    However, when I try to compile it I get the following error:
    random.cs(7,32): error CS1061: 'Random' does not contain a definition for 'Next'
    and no extension method 'Next' accepting a first argument of type
    'Random' could be found (are you missing a using directive or an
    assembly reference?)
    Any idea why? I can't seem to figure it out and it's driving me insane!

  2. #2
    Senior Member
    Join Date
    Aug 2005
    Location
    Brisbane
    Posts
    612
    Thanks
    20
    Thanked
    35 times in 22 posts
    • toolsong's system
      • Motherboard:
      • ASUS P7P55D EVO
      • CPU:
      • i7 860 @ 3.8 GHz
      • Memory:
      • 2 x 4GB Corsair Vengeance
      • Storage:
      • SSDs
      • Graphics card(s):
      • GTX970
      • PSU:
      • Seasonic X650
      • Case:
      • Antec P180
      • Operating System:
      • Win7 x64
      • Monitor(s):
      • Dell U2515H
      • Internet:
      • Fibre @ 100/40

    Re: Any C# programmers here? (Should be simple..)

    You've named your class "Random" and so its scope is higher than System.Random

  3. #3
    Senior Member
    Join Date
    Aug 2004
    Location
    W Yorkshire
    Posts
    5,691
    Thanks
    85
    Thanked
    15 times in 13 posts
    • XA04's system
      • Motherboard:
      • MSI X570-A Pro
      • CPU:
      • AMD Ryzen 5 3600
      • Memory:
      • Corsair 2x 8gb DDR 4 3200
      • Storage:
      • 1TB Serpent M.2 SSD & 4TB HDD
      • Graphics card(s):
      • Palit RTX 2060
      • PSU:
      • Antec Truepower 650W
      • Case:
      • Fractcal Meshify C
      • Operating System:
      • Windows 10
      • Monitor(s):
      • iiyama 34" Curved UWQHD
      • Internet:
      • Virgin 100mb Fibre

    Re: Any C# programmers here? (Should be simple..)

    Oh dear.. haha, thought it would be something silly.

    Cheers!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Simple Backup Software
    By [GSV]Trig in forum Software
    Replies: 6
    Last Post: 12-09-2008, 10:15 AM
  2. newbie with simple adsl question
    By Unique in forum Networking and Broadband
    Replies: 8
    Last Post: 11-07-2008, 10:22 PM
  3. Replies: 2
    Last Post: 02-03-2006, 03:11 PM
  4. Help with a simple online database
    By 5cupa in forum Software
    Replies: 6
    Last Post: 24-02-2006, 05:30 PM
  5. Simple Question...
    By ajbrun in forum PC Hardware and Components
    Replies: 1
    Last Post: 07-06-2004, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •