Ho un metodo che accetta una tabella hash e sto usando concat per aggiungerla alla fine di una tabella hash diverso, ma sto ottenendo questo errore:Aggiungi Hashtable alla fine di un altro Hashtable
The type arguments for method
System.Linq.Enumerable.Concat<TSource>(this System.Collections.Generic.IEnumerable<TSource>, System.Collections.Generic.IEnumerable<TSource>)'
cannot be inferred from the usage.
I don capisco bene cosa significa o cosa ho sbagliato Il mio metodo è il seguente:
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);
}
Spero che tu possa aiutare a spiegare il mio errore, ancora nuovo in C#.
Quando si enumera una HashTable, si * solo * enumera le ** chiavi **. Fondamentalmente, LINQ ti sta dicendo che hai bisogno dei * valori * per le chiavi che stai 'concat''ing. – Tersosauros
Si noti inoltre che HashTable/Dictionary non ha il concetto di ordine, quindi "aggiungi alla fine" non è un'operazione valida su questi tipi. –
@Tersosauros quindi devo usare un ciclo for? In tal caso, non potrei usare semplicemente '.Add' per ogni chiave dell'altro? – WDUK