渡された文字列に基づいて基本クラスのリストのリストからリストを返すための最良の方法は何ですか。
public List<myBaseData> FindFromListofLists(string aClass, List<List<myBaseData>> data)
{
foreach (var item in data)
{
foreach(myBaseData baseData in item)
{
if (baseData.ToString().CompareTo(aClass) == 0) //not sure if this is the best way as if the class overides the toString method...
return item;
}
}
return null;
}
これを行うためのより良い方法があると確信しています。どんな助けでもいただければ幸いです。