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 'page life cycle' of an ASP.NET MVC?

608


How can we determine action invoked from HTTP GET or HTTP POST?

567


Is it possible to combine asp.net webforms and asp.mvc and develop a single web application?

545


What is page life cycle?

530


Can you set the unlimited length for "maxjsonlength" property in config?

561






Explain JSON Binding?

621


What does mvvm mean?

554


What is the difference between windows vista and .net framework 3.0 ?

543


Describe the roles of clr in .net framework.?

642


Explain ASP.NET MVC Identity and Security?

574


What are sections?

575


What is controllercontext?

544


Explain linq to entities? : Entity framework

550


How do you specify comments using razor syntax?

605


Why is the .net framework 3.0 a major version number of the .net framework if it uses the .net framework 2.0 runtime and compiler?

564