Почему переменная players1 принимает значение LEARNING.PROGRAM+User;
В конечном итогде отображается игрок LEARNING.PROGRAM+User; имеет уровень 5, почему не Nick1? ;
using System;
using System.Collections.Generic;
namespace LEARNINNG
{
class Program
{
static void Main(string[] args)
{
User players1 = new User("Nick1");
User players2 = new User("Nick2");
LVL[] lvl = { new LVL(players1, 5), new LVL(players2, 1) };
LeaderBoard leders = new LeaderBoard(lvl);
leders.ShowLeaders();
}
class User
{
public string Name;
public User(string name)
{
Name = name;
}
}
class LVL
{
public User Igrok;
public int level;
public LVL(User user, int lvl)
{
Igrok = user;
level = lvl;
}
public void showlevel()
{
Console.WriteLine($"Игрок {Igrok} имеет уровень {level}");
}
}
class LeaderBoard
{
public LVL[] PlayerLevel;
public LeaderBoard(LVL[] levels)
{
PlayerLevel = levels;
}
public void ShowLeaders()
{
for (int x = 0; x < PlayerLevel.Length; x++)
{
PlayerLevel[x].showlevel();
}
}
}
}
}
Источник: Stack Overflow на русском