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

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

    Oct 2, 2013 · C# will infer the type based on arguments, so explicitly specifying <MyClass1> isn't needed in this case - obviously if there are no parameters on the method, you will need to …

  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. C++ catching all exceptions - Stack Overflow

    Jan 14, 2016 · A generic exception catching mechanism would prove extremely useful. Doubtful. You already know your code is broken, because it's crashing. Eating exceptions may mask …

  5. C# generics syntax for multiple type parameter constraints

    Generic methods and multiple constraints. I need a generic function that has two type constraints, each inheriting from a different base class. I know how to do this with one type: void foo<T>() …

  6. c# - Generics used in struct vs class - Stack Overflow

    Dec 6, 2012 · Assume that we have the following struct definition that uses generics: public struct Foo&lt;T&gt; { public T First; public T Second; public Foo(T first) { this.First = f...

  7. What is cool about generics, why use them? - Stack Overflow

    Generic types allow you to create role-based classes and interfaces. This has been said already in more basic terms, but I find you start to design your code with classes which are …

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

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

  10. Manually raising (throwing) an exception in Python

    Jun 13, 2022 · Don't raise generic exceptions. Avoid raising a generic Exception. To catch it, you'll have to catch all other more specific exceptions that subclass it. Problem 1: Hiding bugs raise …

Refresh