© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
14 replies
Tony

❔ Program does not contain static 'Main'

using System.Collections.Specialized;
using System.Security.Cryptography.X509Certificates;
class Player
{
    public string _playerName;
    public int playerID;
    public Player(string playerName, int playerIdentifier)
    {
        _playerName = playerName;
        playerID = playerIdentifier;
    }
}
class Program
{
    List<Player> Players = new List<Player>();
    void banPlayer(string _playerBan)
    {
        foreach (Player _player in Players)
        {
            if (_player._playerName == _playerBan)
            {
                Players.Remove(_player);
                Console.WriteLine("ID: " + _player.playerID + " has been removed");
            }
        }
    }
    public void Main()
    {
        string[] input;
        while (Players.Count < 5)
        {
            input = Console.ReadLine().Split(' ');
            Player player = new Player(input[0], Int32.Parse(input[1]));
            Players.Add(player);
        }
        banPlayer(Console.ReadLine());

    }
}
using System.Collections.Specialized;
using System.Security.Cryptography.X509Certificates;
class Player
{
    public string _playerName;
    public int playerID;
    public Player(string playerName, int playerIdentifier)
    {
        _playerName = playerName;
        playerID = playerIdentifier;
    }
}
class Program
{
    List<Player> Players = new List<Player>();
    void banPlayer(string _playerBan)
    {
        foreach (Player _player in Players)
        {
            if (_player._playerName == _playerBan)
            {
                Players.Remove(_player);
                Console.WriteLine("ID: " + _player.playerID + " has been removed");
            }
        }
    }
    public void Main()
    {
        string[] input;
        while (Players.Count < 5)
        {
            input = Console.ReadLine().Split(' ');
            Player player = new Player(input[0], Int32.Parse(input[1]));
            Players.Add(player);
        }
        banPlayer(Console.ReadLine());

    }
}
image.png
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

✅ Rider Program does not contain Static Main
C#CC# / help
2y ago
✅ How do I fix Program does not contain a static 'Main' method suitable for an entry point ?
C#CC# / help
5d ago
RuntimeBinderException: '' does not contain 'Any()'
C#CC# / help
2y ago
❔ can a static class contain static class as property
C#CC# / help
3y ago