About 779,000 results
Open links in new tab
  1. c# - How to compare values of generic types? - Stack Overflow

    @gstercken: One problem with IComparable overloading the comparison operators is that there are situations where X.Equals(Y) should return false, but X.CompareTo(Y) should return zero …

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

    Mar 24, 2014 · You cannot have instances of generic functions or actions - all type parameters are defined upfront and cannot be redefined by the caller. An easy way would be to avoid …

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

    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 first value …

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

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

    Dec 5, 2012 · Well, I'd rather like it if I could have the generic optional, as there will be many cases where I don't know what type something will be coming in. (Data is coming from an …

  6. Nullable type as a generic parameter possible? - Stack Overflow

    Oct 16, 2008 · Multiple generic constraints can't be combined in an OR fashion (less restrictive), only in an AND fashion (more restrictive). Meaning that one method can't handle both …

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

    Mar 26, 2015 · Generic selection is implemented with a new keyword: _Generic. The syntax is similar to a simple switch statement for types: _Generic( 'a', char: 1, int: 2, long: 3, default: 0) …

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

  10. How do I get the type name of a generic type argument?

    This extension method outputs the simple type name for non-generic types, and appends the list of generic arguments for generic types. This works fine for scenarios where you don't need to …

Refresh