我有这样的代码:
void Foobar(string[] arr, Dictionary<string, string[]>)
{
var t = arr.Intersect(dic.Keys).ToList(); // .or ToArray() ?
foreach(var item in t)
{
..
}
var j = t.Count; // also I need this
}
Run Code Online (Sandbox Code Playgroud)
哪种方法更受欢迎?
我可以没有任何东西,但我需要知道大小,我不想打电话Enumerable.Count<T>()- 似乎做了更多的行动然后Array<T>.Size或List<T>.Count.我对吗?