About 785,000 results
Open links in new tab
  1. How can I pass in a func with a generic type parameter?

    Mar 24, 2014 · 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. …

  2. 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 …

  3. 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 …

  4. C# generic type constraint for everything nullable

    Apr 11, 2017 · The first suggestion using default is perfect! Now my template with a generic type being returned can return a null for objects and the default value for built-in types.

  5. Can I make a generic optional, defaulting to a certain class?

    Dec 5, 2012 · My question is related to Is there a reasonable approach to &quot;default&quot; type parameters in C# Generics?, but using an inner generic class that approach doesn't work. …

  6. Using Mockito to mock classes with generic parameters

    Is there a clean method of mocking a class with generic parameters? Say I have to mock a class Foo&lt;T&gt; which I need to pass into a method that expects a Foo&lt;Bar&gt;. I can do the …

  7. Using List<T> in C# (Generics) - Stack Overflow

    Oct 2, 2013 · That's not how generics work. MyMethod(List<T> list) is an invalid method signature (unless your class is a generic class with a Type Parameter T)

  8. Creating a generic method in C# - Stack Overflow

    Jan 27, 2010 · 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 …

  9. exception - Generic catch for python - Stack Overflow

    Jan 14, 2009 · Generic catch for python Asked 16 years, 6 months ago Modified 5 years, 2 months ago Viewed 134k times

  10. Case insensitive access for generic dictionary - Stack Overflow

    Nov 5, 2012 · I have an application that use managed dlls. One of those dlls return a generic dictionary: Dictionary&lt;string, int&gt; MyDictionary; The dictionary contains keys with upper …