Top "Generics" questions

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

Java Map equivalent in C#

I'm trying to hold a list of items in a collection with a key of my choice. In Java, I …

c# java generics collections
C# - using List<T>.Find() with custom objects

I'm trying to use a List<T> with a custom class of mine, and being able to use …

c# list generics delegates find
How to make a Java Generic method static?

The following is a snippet on how to make a java generic class to append a single item to an …

java generics
Converting a generic list to a CSV string

I have a list of integer values (List) and would like to generate a string of comma delimited values. That …

c# generics .net-3.5
What is the difference between 'E', 'T', and '?' for Java generics?

I come across Java code like this: public interface Foo<E> {} public interface Bar<T> {} public …

java generics
Difference between List, List<?>, List<T>, List<E>, and List<Object>

What are the differences between List, List<?>, List<T>, List<E>, and List<…

java generics
C# Create New T()

You can see what I'm trying (but failing) to do with the following code: protected T GetObject() { return new T(); } …

c# .net generics c#-4.0 .net-4.0
Java generics: multiple generic parameters?

I was wondering if it's possible to write a function that accepts multiple generic types as follows: public int void …

java generics parameters
Check if a class is derived from a generic class

I have a generic class in my project with derived classes. public class GenericClass<T> : GenericInterface<T&…

c# generics reflection
Java Generics Wildcarding With Multiple Classes

I want to have a Class object, but I want to force whatever class it represents to extend class A …

java class generics bounded-wildcard