c# - Generics in a Dictionary as an Input in a method -
i trying create method accepts dictionary input.
however, when try add following:
public void writetojsonfile(dictionary<string, t> diclist) { ... stuff } it state t missing assembly or reference. now, have worked around adding
<t> to class name generic class. using dictionary class want create method accept dictionary key string value can of object?
i have worked around adding
<t>class name generic class.
you should not this, unless have specific need class generic.
all want create method accept dictionary key string value can of object?
all need dictionary<string,object> then: way, single dictionary have objects of different types, keyed string. better, use idictionary<string,object> let class users pass other implementations of idictionary<k,v> interface.
Comments
Post a Comment