Why did you devise invoking generics functions like you did?
I understand that the method of use is "compatible" to that of generic classes
but isn't it a bit clumsy? Or am I missing something?
Wouldn't it have been "cooler" to have just been able to invoke a generic method
without having to state which type you want to use it with (in questionable
cases one could always revert to type casting)? The paramaters would be
suffictient to identify the type wouldn't they?
Generic Funtion:
public ItemType GenericFunction<ItemType>(ItemType
item)
{
// (Process item here.)
return item;
}
The code that calls GenericFunction() defines the type, which is then used for a
parameter to the function and a method.
way to invoke at the time:
string input = "...";
string output = Obj.GenericFunction<string>(input);
how about this?
string input = "...";
// input is string, so thats the type to use...
string output = Obj.GenericFunction(input);