113 questions for “Generics”

Found in 1 field. Select a question to see its full answer.

Information Technology

113 questions in 4 technologies

#QuestionTechnologyTopicLevel
1What are generics in C#, and what specific problems do they solve compared to writing type-specific code? C# › GenericsC#GenericsIntermediate
2What are generics and why use them? C# › GenericsC#GenericsBeginner
3What problem do generics solve compared to using 'any' for a reusable function? TypeScript › GenericsTypeScriptGenericsBeginner
4What problem do generics solve compared to writing a method or class that accepts 'object'? C# › GenericsC#GenericsBeginner
5What problem do generics solve compared to using raw types (like a pre-Java-5 List without a type parameter), and how do they improve compile-time type safety? Java › GenericsJavaGenericsBeginner
6What is covariance and contravariance in generics? C# › GenericsC#GenericsIntermediate
7What is a raw type in Java, and why does the compiler still permit using them (with an unchecked warning) despite generics having been available since Java 5? Java › GenericsJavaGenericsIntermediate
8How are generics implemented for value types vs reference types in the CLR? C# › GenericsC#GenericsAdvanced
9How do generics interact with arrays, and why does the JDK itself sometimes use an unsafe cast (like in ArrayList's internal implementation) to work around the inability to create generic arrays directly? Java › GenericsJavaGenericsAdvanced
10How does variance (covariance, contravariance, invariance) apply differently to Java arrays versus Java generics, and what practical safety trade-off does this design difference represent? Java › GenericsJavaGenericsAdvanced