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

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

  3. c# - Generic Unit Of Work - Stack Overflow

    Sep 6, 2016 · 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 …

  4. How do I make the return type of a method generic?

    If you would want to return a value which is not type casteable to the generic type you pass, you might have to alter the code or make sure you pass a type that is casteable for the return …

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

  6. What is the syntax for Typescript arrow functions with generics?

    Aug 31, 2015 · I found the example above confusing. I am using React and JSX so I think it complicated the scenario. I got clarification from TypeScript Deep Dive, which states for arrow …

  7. 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 "default" type parameters in C# Generics?, but using an inner generic class that approach doesn't work. …

  8. 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, …

  9. Java: Instanceof and Generics - Stack Overflow

    Oct 15, 2009 · Before I look through my generic data structure for a value's index, I'd like to see if it is even an instance of the type this has been parametrized to. But Eclipse complains when I …

  10. java - How to Map to Generic Type? - Stack Overflow

    Aug 5, 2019 · Mapstruct is a code generator. So it needs to know which types to construct in order to generate a method implementation. Having said that, you could do this smarter by using a …