My Case(I get compile error because T undefined):
public void f1(Dictionary<string,T> d){
}
How Can I solve the problem(I cant pass Object i have to pass original var type)?
(I am using .net 4.5)
Thanks
You need to add the type parameter T
:
public void f1<T>(Dictionary<string,T> d){
}
If you want the dictionary to contain values of any type then your only option is to use a Dictionary<string, object>
and cast as appropriate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With