adspace


Why do we need generics?

Answer Posted / Atul Kumar Singh

"We need generics to write reusable, flexible, and efficient code. Generics allow us to create a single implementation of a class or method that can work with multiple data types without having to duplicate the code for each data type. This helps reduce redundancy and makes our code easier to maintain and extend."

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to assign Null value to Var?

1063


What is an abstract class c#?

969


Which namespaces are necessary to create a localized application?

1142


How do you inherit a class into other class in c#?

994


What is expression tree in c#?

998


Why can't we use a static class instead of singleton?

954