I know i could make a generic version and then inherit from it for the int version, but i was just hoping to get it all in one.but i didn't know of any way to do that. Exists in.net any class static method or whatever to convert any list into a datatable I have a generic method that takes a request and provides a response
Elle (u/Generic_Egirl) - Reddit
Public tres dosomething<tres, treq>(tres response, treq request) {/*stuff*/} but i don't always want a response for my request, and i don't always want to feed request data to get a response
I also don't want to have to copy and paste methods in their entirety to make minor changes
What i want, is to be able to do this. You can certainly define generic delegates, after all, that's exactly what func and action are They are treated as generic definitions, just like generic interfaces and classes are However, you cannot use generic definitions in method signatures, only parameterized generic types
Quite simply you cannot do what you are trying to achieve with a delegate alone. What keeps us from comparing the values of generic types which are known to be icomparable Doesn't it somehow defeat the entire purpose of generic constraints? Using lookupdictionary = system.collections.generic.dictionary<string, int>
Now i want to accomplish the same with a generic type, while preserving it as a generic type
But that doesn't compile, so is there any way to achieve creating this alias while leaving the type as generic? Is there a clean method of mocking a class with generic parameters Say i have to mock a class foo<t> Which i need to pass into a method that expects a foo<bar>
I can do the following For one class i want to store some function pointers to member functions of the same class in one map storing std::function objects But i fail right at the beginning with this code I have few methods that returns different generic lists