Top "Generics" questions

Generics are a form of parametric polymorphism found in a range of languages, including .NET languages, Java, Swift, and Rust.

Convert string to nullable type (int, double, etc...)

I am attempting to do some data conversion. Unfortunately, much of the data is in strings, where it should be …

c# .net generics extension-methods type-conversion
Select a Dictionary<T1, T2> with LINQ

I have used the "select" keyword and extension method to return an IEnumerable<T> with LINQ, but I …

c# .net linq generics
Mockito: List Matchers with generics

Mockito offers: when(mock.process(Matchers.any(List.class))); How to avoid warning if process takes a List<Bar&…

java generics warnings mockito matcher
C# Generics and Type Checking

I have a method that uses an IList<T> as a parameter. I need to check what the …

c# generics types
What does "where T : class, new()" mean?

Can you please explain to me what where T : class, new() means in the following line of code? void Add&…

c# generics type-constraints
What is the "proper" way to cast Hibernate Query.list() to List<Type>?

I'm a newbie with Hibernate, and I'm writing a simple method to return a list of objects matching a specific …

java hibernate generics
how to instanceof List<MyType>?

How can I get this sort of thing to work? I can check if (obj instanceof List<?>) but …

java generics
How to make a Generic Type Cast function

Possible Duplicate: is there a generic Parse() function that will convert a string to any type using parse? I want …

c# .net generics
The type must be a reference type in order to use it as parameter 'T' in the generic type or method

I'm getting deeper into generics and now have a situation I need help with. I get a compile error on …

c# generics
How do I read an attribute on a class at runtime?

I am trying to create a generic method that will read an attribute on a class and return that value …

c# generics custom-attributes