c# - Is there any way to use a type-parameter within an indexer declaration? -


i don't think so, before give , use method:

public t this<t>[string index] {     get{         //return stuff     } } 

i don't have type parameter in class. want return different type based on want get.

for example:

myobject<string>["savedstring"] 

is there syntax that? (i can't compile of code above, of course.)

no, properties can't generic in c#. nor can events, constructors, variables, operators or finalizers.

basically there generic types , generic methods, , that's it.


Comments