what are generics? Without generics what are the
disadvantages in 1.1?
Answers were Sorted based on User's Feedback
Answer / purushottam.ambati@gmail.
Generics is a concept introduced in .NET 2.0 and these are
just like templates in C++. Using generics we can create
classes,methods,events, delegates which work with any type
(like int,string,myclass etc). In .NET 2.0,
System.Collections.Generic namesapce was introduced and it
contains classes/interfaces related to generics. Advantages
are Performance, Code Reuse, Type Safety.
we can create generic classes (which work with any type)
in .NET 1.1 by using System.Object class. But, it requires
type casting, boxing and unboxing operations internally.
these operations are very expensive. so performace of
application will degrade.
| Is This Answer Correct ? | 18 Yes | 1 No |
Answer / 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 |
Answer / rama krishna
Generics are place holders for the actuval data types.
Generics are defenied with left and right angular brackets.
once we develop,test and deploy it may be used with feature
data types also.
| Is This Answer Correct ? | 4 Yes | 1 No |
Is the following route definition a valid route definition? {controller}{action}/{id}
What is objectset? : Entity framework
Do you know about the new features in asp.net mvc 4 (asp.net mvc4)?
Can you Write the GC(Garbage Collector) Algoritham in .NET? (But not Explination of Working of GC).
what is an assembly?
How large is the .net framework 3.0?
What are the options can be configured in AJAX helpers?
How we can call a javascript function on the change of a dropdown list in mvc?
Is .net core faster than .net framework?
If Controller is not there in MVC Pattern what happens?
What is the difference between using system.net and system.net.sockets?
Explain bundle.config in mvc4?