|
- C# Generics and Type Checking - Stack Overflow
A great example of when this would be useful is generic serialization with wildly varying types If the object being passed in is a string, why do the extra work?
- How can I pass in a func with a generic type parameter?
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
- c# - Generic Unit Of Work - Stack Overflow
I have implemented EntityFramework pattern along with Repository and Unit Of Work The implementation is similar to Code Project Repository Example, however I need an enhancement for the Unit Of Wo
- c# - How to compare values of generic types? - Stack Overflow
So, two questions: Why do we observe this weird behaviour? 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? How do I resolve this, or at least work around it?
- void in C# generics? - Stack Overflow
I have a generic method that takes a request and provides a response 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
- Creating a generic method in C# - Stack Overflow
I am trying to combine a bunch of similar methods into a generic method I have several methods that return the value of a querystring, or null if that querystring does not exist or is not in the
- Using a using alias = class with generic types? [duplicate]
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: using List<T> = System Collections Generic List<T>; But that doesn't compile, so is there any way to achieve creating this alias while leaving the type as generic?
- Generic constraints, where T : struct and where T : class
Actually, it is possible to differentiate the type of a method call based upon constraints if one doesn't mind having a dummy "optional" parameter of a generic reference type which has constraints on its generic arguments, and having a "null" default value for that parameter
|
|
|