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 objectcontext? : Entity framework

821


I want to fetch data from datareader. i have three tables in datareader. i want to bind my two table with datagrid, then i want to fetch a value from my third table. do u have any idea pls help me. we use dr.nextresult() for multiple tables.

2360


Explain the new features 3.5 framework against with the tool?

687


Can I use razor code in javascript in asp.net mvc?

755


What is the advantage of mvc?

791






What is separation of concerns in asp.net mvc?

774


What are the possible razor view extensions?

757


How does servicing work for the .net framework 3.0?

682


Is .net core replacing .net framework?

689


How do I use partial view?

710


Which are the important namespaces used in ASP.Net MVC?

787


what is ssdl?

877


What is difference between viewbag and viewdata and tempdata?

737


mention what is csdl, ssdl and msl sections in an edmx file?

780


List out few different return types of a controller action method?

783