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
What is postback request?
Explain how dot net compiled code will become platform independent?
What is a page life cycle?
Just by seeing the signature of the bean how can you specify whether it is a stateful or stateless session bean?
Why we use dbms for projects? Why don’t we save any application data in separate files instead of dbms?
Are xaml file compiled or built on runtime?
Can one dll file contains the compiled code of more than one .net language?
Explain the use of resource manager class in .net.
What is Model-View-View Model?
Where sessions are stored?
List the types of authentication supported by asp.net?
How does asp net store session ids by default?
Explain the role of global.asax?
What is the function of new view engine in asp.net? : asp.net mvc
When Cookies are expired in ASP.NET?