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

Is .net framework 4.8 the last version?

538


Is mvc 4 supporting windows azure sdk (software development kit) ?

564


What operating systems will the .net framework 3.0 be available for?

574


What is the difference between entity framework and mvc?

523


What is entity framework in asp net?

541






Describe the .net framework architecture.

586


What are child actions in ASP.Net MVC?

585


What is mapping in entity framework? : Entity framework

526


Explain ASP.NET MVC Identity and Security?

577


What is representational state transfer (rest) mean?

555


What is the difference between viewbag and viewdata in mvc?

541


Explain entity lifecycle? : Entity framework

552


What are the 3 main components of an asp.net mvc application?

543


How we can add the css in mvc?

596


What is renderbody?

553