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

  2. How to register dependency injection with generic types? (.net core)

    May 23, 2019 · I have an asp.net core web app with multiple parameters in appSettings.json file. I didnt' want to have services having IOptions<MyObject> in the constructor. I wanted …

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

  4. How do I get a class instance of generic type T? - Stack Overflow

    I have a generics class, Foo&lt;T&gt;. 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?

  5. How do I write a genric display function in C to display void …

    Dec 13, 2020 · How do I write a genric display function in C to display void pointers of all data types? Asked 5 years ago Modified 5 years ago Viewed 428 times

  6. java - Create generic List - Stack Overflow

    Mar 20, 2013 · How I can create genric List in Java? I also can pass Class<T> instance to the method. Like this:

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

  8. reactjs - How to make a generic textfield that is controllable by …

    Oct 28, 2022 · Context: I am using react-hook-forms to create a list of text fields (controlled by the controller).I'm finding that I'm writing quite a bit of similar code and thought to create a generic …

  9. java - Jackson - Deserialize using generic class - Stack Overflow

    I have a json string, which I should deSerialize to the following class class Data &lt;T&gt; { int found; Class&lt;T&gt; hits } How do I do it? This is the usual way mapper.readValue(json...

  10. How can I create a generic array in Java? - Stack Overflow

    public class GenSet<E> { private E a[]; public GenSet() { a = new E[INITIAL_ARRAY_LENGTH]; // Error: generic array creation } } How can I implement this while maintaining type safety? I …