About 739,000 results
Open links in new tab
  1. 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 …

  2. How do you provide a default type for generics? - Stack Overflow

    Jul 8, 2009 · The generic parameter type will be the same for all methods, so I would like it at the class level. I know I could make a generic version and then inherit from it for the int version, …

  3. Syntax and Sample Usage of _Generic in C11 - Stack Overflow

    Mar 26, 2015 · Note about the placing of the function parameter list When using a Generic() to select a function based on the controlling-expression you have the choice of including the …

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

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

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

  7. Generic Constraint for Non Nullable types - Stack Overflow

    Applying where T : struct applies a generic constraint that T be a non-nullable value type. Since there are no non-nullable reference types, this has the exact same semantics as simply "all …

  8. c# - Get property of generic class - Stack Overflow

    I have a generic class, and an object value where obj.GetType().GetGenericTypeDefinition() == typeof(Foo<>). class Foo<T> { public List<T> Items { get; set; } } How do I get the value of …

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

  10. Find a specified generic DbSet in a DbContext dynamically when I …

    Find a specified generic DbSet in a DbContext dynamically when I have an entity Asked 11 years, 9 months ago Modified 5 months ago Viewed 67k times