About 50 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 is the meaning of "generic programming" in c++?

    Oct 5, 2010 · What is the meaning of generic programming in c++? Also, I am trying to figure out what container, iterator, and different types of them mean.

  3. generics - How to declare an ArrayList of Genric ArrayLists (2d ...

    Nov 10, 2020 · So I've been trying to create an ArrayList of ArrayList of Generics. Basicaly I have a generic class called Color(which takes in Integer/Long/short values at runtime). And now I wanted to …

  4. java - Instanceof and Generics - Stack Overflow

    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 parameterized to. But Eclipse complains when I do this: @Ove...

  5. How to return Generic response from Controller? - Stack Overflow

    Mar 24, 2021 · return StatusCode(404, result.MapFileFileUploadSummary); return StatusCode((int)System.Net.HttpStatusCode.Unauthorized); In the above code when I return some …

  6. android - How to pass parameter in function as parameter to another …

    Jun 10, 2021 · Also i want to make a genric runFunction which can take any parameter i.e. Int, String etc. In this example code i am sending sumInt (2) to runFunction also i want to send …

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

    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

  8. Cast generic type parameter to a specific type in C#

    Aug 31, 2016 · void SomeMethod(T t) { SomeClass obj2 = (SomeClass)(object)t; } Is there a better way to achieve this, rather than casting it to an object and then to a specific type? Problem: I have a …

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

    Feb 11, 2015 · DoesEntityExist<string> This is how the compiler is able to enfore compile-time type safety. For the scenario you describe, you should pass the type as an argument that can be …

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

    Aug 4, 2010 · How can I achieve this? public class GenericClass&lt;T&gt; { public Type getMyType() { //How do I return the type of T? } } Everything I have tried so far always returns type O...