Why do we need generics?



Why do we need generics?..

Answer / 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

More C Sharp Interview Questions

Can you declare the override method static while the original method is non-static?

3 Answers  


what is the default access for a class

1 Answers   Cognizant,


What is ilasm.exe used for?

1 Answers  


wipro interview question on 28-Apr-10 1.what type of authentication used in web service, 2.what are type of multithreding ? 3.diff bet delegate and multithreading? 4.how to write update query trigger in stored procedure. 5. if you are so sharp then what happens when you click .net appln exe in system,who CLR get loaded. 6.how to use work flown in application. 7.what is main purpose of script manager. 8.how u handle cretical transaction. 9.how you syncronize the method from no of user, 10.how change name of shared assambly

1 Answers  


Explain manifest in c#.

1 Answers  


What are native functions?

1 Answers  


How many root nodes are there in an xml document?

1 Answers  


What namespaces are necessary to create a localized application?

2 Answers   Rolta, Siebel Systems, Visual Soft,


How to run the program at particular time? It should run everyday at 3:00 PM. After executing the program should sleep until next day at 3:00 PM. Please explain with code?

5 Answers   Sanat, Wipro,


Explain about Oops concept

1 Answers   Digital GlobalSoft,


Explain synchronous and asynchronous operations?

1 Answers  


Is for loop faster than foreach?

1 Answers  


Categories