Tony
Tony
CC#
Created by Tony on 2/10/2023 in #help
❔ Program does not contain static 'Main'
15 replies
CC#
Created by Tony on 2/10/2023 in #help
✅ Tuples in classes
using System.Collections.Specialized;

class Program
{
static void Main(string[] args)
{
string[] input = Console.ReadLine().Split(' ');
Player player = new Player(input[0], Int32.Parse(input[1]));
}
class Player
{
public string _playerName;
public int playerID;
public Player(string playerName,int playerIdentifier)
{
_playerName = playerName;
playerID = playerIdentifier;
Tuple<string, int> playerInfo = new Tuple<string, int>(_playerName,playerID);
}
}
}
using System.Collections.Specialized;

class Program
{
static void Main(string[] args)
{
string[] input = Console.ReadLine().Split(' ');
Player player = new Player(input[0], Int32.Parse(input[1]));
}
class Player
{
public string _playerName;
public int playerID;
public Player(string playerName,int playerIdentifier)
{
_playerName = playerName;
playerID = playerIdentifier;
Tuple<string, int> playerInfo = new Tuple<string, int>(_playerName,playerID);
}
}
}
This may be a beginner question but how do i acces the playerInfo for each Player instance created?
33 replies