About 53 results
Open links in new tab
  1. What's the difference between "general" and "generic"?

    Apr 30, 2014 · Generic is the opposite of specific. Generic and specific refer to the identification of a fact. Specific means a fact that has been specified. If you ask for (specify) a pain reliever, aspirin would …

  2. How do I call a generic method using a Type variable?

    What's the best way to call a generic method when the type parameter isn't known at compile time, but instead is obtained dynamically at runtime? Consider the following sample code - inside the Ex...

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

  4. How can I pass in a func with a generic type parameter?

    Mar 24, 2014 · I like to send a generic type converter function to a method but I can't figure out how to do it. Here's invalid syntax that explains what I like to achieve, the problem is I don't know how to spe...

  5. Create Generic method constraining T to an Enum

    Sep 17, 2008 · Please note though that you can't use generic restriction like where T : Enum because Enum is special type. Therefore I have to check if given generic type is really enum.

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

  7. Find a specified generic DbSet in a DbContext dynamically when I have ...

    The question does not specify EF version and the proposed answer does not work anymore for Entity Framework Core (in EF Core, DbContext does not have a non-generic Set method, at least at the …

  8. Cast to generic type in C# - Stack Overflow

    Jun 28, 2016 · The root issue mentioned above of casting a non-generic version of the class to a derived generic version was the same. In order to allow injection into a portable class library which did not …

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

  10. 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: