what are generics? Without generics what are the
disadvantages in 1.1?

Answer Posted / lakshmi

They are tad similar to C++ templates. With .net 1.0,
creating a flexible class or method that should use classes
that are known at compile time must be based on the object
class. With the object class, theres no type safety during
compile time. casting is necessary. Also, using the object
class for value types has a performance impact. .Net 2.0
supports generics, with generics the object class is no
longer necessary in such scenarios. Generic classes make
use of generic types that are replaced with specific types
as needed. This allows for typesafety. The
system.collections.Generic namespace gives you access to
generic versions of the stack, dictionary,
sorted dictionary, list and queue classes.
Advantages: Binary code reuse, performance, easy of
reading, typesafety.

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between ViewData, ViewBag and TempData?

632


What are the advantages of razor view engine?

522


Briefly describe the roles of clr in .net framework?

534


Which approach provides better support for test driven development - asp.net mvc or asp.net webforms?

502


How route table has been created in asp.net mvc?

549






What is work of clr?

571


What is the mvc pattern (model view controller pattern)?

578


Will c# 3.0, vb.net 9.0, atlas, or linq be included in the .net framework 3.0?

518


Do I need microsoft .net framework?

545


What is controllercontext?

536


Which version of the common language runtime (clr) does the .net framework 3.0 use?

559


What are the benefits of .net framework?

558


How route table has been created in ASP.NET ASP.Net MVC?

548


How the ‘page lifecycle’ of ASP.Net MVC does works?

586


Explain what languages does the .net framework support?

514