About 788,000 results
Open links in new tab
  1. How do I make the return type of a method generic?

    Apr 5, 2024 · This may not be a best practice but it worked for me. This method takes in an array of generic type and a value to add to the end of the array. The array is then copied with 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. 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. 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 …

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

  6. Generics in C#, using type of a variable as parameter

    Feb 11, 2015 · Why? Because under the hood, the compiler will go away and create a new type (sometimes called a closed generic type) for each different usage of the "open" generic type. …

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

    Oct 2, 2013 · 18 You need to add the generic type parameter for T to your method: void MyMethod<T>(List<T> list) { The compiler doesn't know what T represents, otherwise.

  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. 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?

  10. exception - Generic catch for python - Stack Overflow

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

  11. Some results have been removed