what is the generics and where used generics in your project?

Answers were Sorted based on User's Feedback



what is the generics and where used generics in your project?..

Answer / msathya20.net

plz explain the answer.

Is This Answer Correct ?    1 Yes 0 No

what is the generics and where used generics in your project?..

Answer / jo

generics is similar to templates in c++ language
by using generics we can delay the type creation

for example we want to swap to values by using swap method
like here int swap(int a=10,int b=5)
{
int temp;
temp=a;
a=b;
b=temp;
}
here we declare the type of variable a first where it is
declared and also we swap to string
swap(string s1="hi",string s2="bye")
{
sting =temp;
temp=s1;
s1=s2;
s2=temp;
}
where we write two methods for two diferent types but using
generics we can achve this simply
swap(<t>a ="hi"<t>b,="bye")
{
<t> temp;
temp=s1;
a=b;
b=temp;
}

Is This Answer Correct ?    1 Yes 0 No

what is the generics and where used generics in your project?..

Answer / santosh

generics are representing a general datatypes.. we can
store the data in any premitive data types..

syn:

public add<G>(GS)
{

}
Calling: obj.add<int>(10)
obj.add<string>(satya)


Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

What is a user session?

0 Answers  


asp.net interview questions

0 Answers  


Can the unique key be null?

0 Answers  


Is it possible to prevent a browser from caching an ASPX page?

3 Answers  


what is pagination in asp.net ?

1 Answers   Netsweeper,






What asp.net control can embed xaml into asp.net pages?

0 Answers  


Is asp.net easy to learn?

0 Answers  


What is the maximum number of classes that can be contained in one dll file?

0 Answers  


What is an assembly?

2 Answers   Value Labs,


Which tool you have done?

0 Answers  


Explain server control extensibility with reference to asp.net 2.0 ?

0 Answers  


What are the disadvantages of view state?

0 Answers  


Categories