© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
77 replies
j_uice

❔ Ignoring Main?

just starting out with c# and have a pretty basic question. Trying to just make a random array of ints and print them out.

class sorting {
    
public static void Main(string[] args) { 
        int[] numsToSort = getListOfNums();
        for (int i = 0; i < numsToSort.Length; ++i) {
            Console.WriteLine(numsToSort[i]);
        }


    }

    public static int[] getListOfNums() {
        Random rand = new Random();
        int[] numsToSort = new int[100];
        for (int i = 0; i < numsToSort.Length; ++i) {
            numsToSort[i] = rand.Next(100);
        }

        return numsToSort;

    }

}
class sorting {
    
public static void Main(string[] args) { 
        int[] numsToSort = getListOfNums();
        for (int i = 0; i < numsToSort.Length; ++i) {
            Console.WriteLine(numsToSort[i]);
        }


    }

    public static int[] getListOfNums() {
        Random rand = new Random();
        int[] numsToSort = new int[100];
        for (int i = 0; i < numsToSort.Length; ++i) {
            numsToSort[i] = rand.Next(100);
        }

        return numsToSort;

    }

}


output:
sorting.cs(1,7): warning CS8981: The type name 'sorting' only contains lower-cased ascii characters. Such names may become reserved for the language. [C
:DivideAndConquer.csproj]
\sorting.cs(2,20): warning CS7022: The entry point of the program is global code; ignoring 'sorting.Main(string[])' entry point. [\DivideAndConquer.csproj]
System.Int32[]
sorting.cs(1,7): warning CS8981: The type name 'sorting' only contains lower-cased ascii characters. Such names may become reserved for the language. [C
:DivideAndConquer.csproj]
\sorting.cs(2,20): warning CS7022: The entry point of the program is global code; ignoring 'sorting.Main(string[])' entry point. [\DivideAndConquer.csproj]
System.Int32[]
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ JsonSerializer ignoring encoding options?
C#CC# / help
2y ago
The entry point of the program is global code; ignoring 'Program.Main(string[])' entry point.
C#CC# / help
3y ago
❔ ASP.NET Core ignoring custom DynamicRouteValueTransformer
C#CC# / help
3y ago
❔ Newtonsoft json parse while ignoring issues
C#CC# / help
3y ago
Next page