C# 添加到对c的列表中#
我正在尝试添加到配对列表中。 我已将名单草签如下C# 添加到对c的列表中#,c#,C#,我正在尝试添加到配对列表中。 我已将名单草签如下 public List<Tuple<string, Dictionary<string, int>>> StudentRecords = new List<Tuple<string, Dictionary<string, int>>>(); public List StudentRecords=new List(); 我正在创建一个方法来添加到此列表,但它出现了一个错误
public List<Tuple<string, Dictionary<string, int>>> StudentRecords = new List<Tuple<string, Dictionary<string, int>>>();
public List StudentRecords=new List();
我正在创建一个方法来添加到此列表,但它出现了一个错误,错误是:
Add方法没有重载,接受2个参数
public void AddRecord(字符串studentname,字典studentMarks)
{
StudentRecords.Add(studentname,studentMarks);
}
有人知道我做错了什么吗?
StudentRecords
是元组的列表。因此,您必须像这样添加一个元组
StudentRecords.Add(Tuple.Create(studentname, studentMarks));
StudentRecords
是元组的列表。因此,您必须像这样添加一个元组
StudentRecords.Add(Tuple.Create(studentname, studentMarks));
是的,您有一个元组列表
,但您没有添加元组。是的,您有一个元组列表
,但您没有添加元组。