我有一个列表,需要根据对象是否已经存在或未命名的国家来添加或修改对象。它包含 Country 类型的对象,它们本身包含名称、点数和 Skier 类型的对象。
List<Country> countries = new List<Country>();
...inputs
string name= inputData[1];
if (find if a country with name exists inside countries list)
{
change the country
}
else
{
make new country
}
我已经弄清楚了其他的东西,但我不知道在 if 中放什么。