我有一个可以接受hashTable的方法,并且我正在使用concat将其添加到其他hashTable的末尾,但是出现此错误:
System.Linq.Enumerable.Concat<TSource>(this System.Collections.Generic.IEnumerable<TSource>, System.Collections.Generic.IEnumerable<TSource>)'
无法从用法中推断出方法的类型参数。
我不完全了解这意味着什么或我错了。我的方法如下所示:
public void resetCameras(Hashtable hashTable)
{
Hashtable ht = new Hashtable();
ht.Add("time", 2.0f);
ht.Add("easeType","easeInOutQuad");
ht.Add("onupdate","UpdateSize");
ht.Add("from",size);
ht.Add("to",5.0f);
if(hashTable != null) {
ht = ht.Concat(hashTable);
}
iTween.ValueTo(gameObject,ht);
}
希望您能帮助解释我的错误,这对C#还是很新的。
不幸的是,没有merge/concat
两个简单的方法HashTables
,您必须以传统方式循环遍历每个条目。
foreach (DictionaryEntry entry in hashTable)
{
if(!ht.ContainsKey(entry.Key))
{
ht.Add(entry.Key, entry.Value);
}
}
// rest of the logic
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句