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

Explain the steps needed to be performed in order to create an animation in xaml?

0 Answers  


How to upload a file using file upload control inside the Update Panel???

2 Answers  


What are Master Pages in ASP.NET? or What is a Master Page?

0 Answers   MCN Solutions,


I have created a configuration setting in my web.config and have kept it at the root level. How do I prevent it from being overridden by another web.config that appears lower in the hierarchy?

0 Answers  


Explain how asp.net page works?

0 Answers  






On what object is the transaction in ADO.NET focused on? a) The command object b) The DataSet object c) The Connection object d) The DataAdapter object

4 Answers   Syntax Softtech,


What are the different types of sessions in asp.net? Name them?

0 Answers  


What is the behavior of a Web browser when it receives an invalid element?

0 Answers   MindCracker,


How do you secure your configuration files to be accessed remotely by unauthorized users?

0 Answers  


Diff between web user control and web custom control?

0 Answers  


What is application session?

0 Answers  


What is preprocessor in .net and type, where it use?

0 Answers  


Categories