C#C
C#3y ago
Tony

✅ 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);
        }
    }
}

This may be a beginner question but how do i acces the playerInfo for each Player instance created?
Was this page helpful?