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 login controls.
Can we have multiple web config files for an asp.net application?
hi .net gurus. plz if any one has dumps on 70-631 and 70-541 on windows sharepoint services kindly mail me.
What is postback pixel?
What is the difference between a default skin and a named skin?
How can we pass info between 2 asp.net pages?
Is it possible to create web application with both webforms and mvc?
What are the two types of web pages?
14. What are your Future Plans for Swatz Oils GROUP U.K?
What is diff. Between abstract class and an interface?
Explain the role of global.asax?
How would you get asp.net running in apache web servers? Explain it's limitations.
Explain Apache web servers ? How can you get ASP.NET running in Apache web servers - why should you do this?
there is two functions function a and function b like fun a(){.... ..... } fun b() { } in function b i write the coding to add two numbers and i need to dispaly the sum result in function a with out using global variable. how we do?
Write code to send e-mail from an asp.net application?