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

If I'm developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?

7 Answers   Syntax Softtech,


What are the page level transaction and class level transaction?

1 Answers   Satyam,


what is view state and its use

10 Answers   DELL, Efextra, HCL,


what is uncle aunty file

1 Answers  


What is the file extension of web service?

0 Answers  






What are themes and skins in 2.0, explain usage scenario?

0 Answers  


Is asp.net still used?

0 Answers  


What are two ways that you can set the minimum and maximum values for a rangevalidator? When would you use each technique?

1 Answers  


Explain how dot net compiled code will become platform independent?

0 Answers  


What is the use of Administration tool in Asp.net 2.0?

2 Answers  


How do you manage session in ASP and ASP.NET?

1 Answers   Microsoft,


Why do we use sessions?

0 Answers  


Categories