what is the generics and where used generics in your project?
Answer Posted / 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 |
Post New Answer View All Answers
Explain the difference between AutoPostBack and IspostBack in ASP.NET?
Can you explain the basic use of dataview?
What is __ requestverificationtoken?
Why asp.net is better than php?
Explain the significance of routing? : asp.net mvc
What are Master Pages in ASP.NET?
What does session_start () do?
What is enableviewstate?
How Session outproc in Sqlserver stored?
Why do we need url encoding?
Explain Life cycle of ASP.NET page when a request is made.
Explain the Order of events in an asp.net page?
What is asp.net and how it works?
Is it possible to create web application with both webforms and mvc?
What is the application pool?