About 52 results
Open links in new tab
  1. How do I get a class instance of generic type T? - Stack Overflow

    I have a generics class, Foo<T>. In a method of Foo, I want to get the class instance of type T, but I just can't call T.class. What is the preferred way to get around it using T.class?

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

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

  4. c# - Overriding inherited generic methods - Stack Overflow

    Aug 9, 2016 · You can't override a generic method's type parameter in a derived class. To achieve a similar functionality, one option is to have your base class be a generic class, and …

  5. java - Get generic type of class at runtime - Stack Overflow

    Aug 4, 2010 · 0 If you cannot change the generic class and use one of the method already explained on this page, then simple approach would be to get the type class based on the …

  6. C# generic type constraint for everything nullable

    Apr 11, 2017 · The first suggestion using is perfect! Now my template with a generic type being returned can return a null for objects and the default value for built-in types.

  7. c# - Why does a generic type constraint result in a no implicit ...

    Jul 3, 2013 · I have created a couple of interfaces and generic classes for working with agenda appointments: interface IAppointment&lt;T&gt; where T : IAppointmentProperties { T …

  8. c# - A generic list of anonymous class - Stack Overflow

    There are many ways to do this, but some of the responses here are creating a list that contains garbage elements, which requires you to clear the list. If you are looking for an empty list of …

  9. Google Gson preserve generic signatures - Stack Overflow

    May 11, 2023 · Google Gson preserve generic signatures Asked 2 years, 8 months ago Modified 1 year, 5 months ago Viewed 12k times

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

    229 Is there a way to make this method generic so I can return a string, bool, int, or double? Right now, it's returning a string, but if it's able find "true" or "false" as the configuration value, I'd like …