what is the generics and where used generics in your project?
Answers were Sorted based on User's Feedback
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 |
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 |
Which control would you use if you needed to make sure the values in two different controls matched?
Why is this service branded with windows livetm?
Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
Write a standard lock() plus double check to create a critical section around a variable access?
What is the transport protocol you use to call a Web service?
What is redirectpermanent in asp.net?
Explain the difference between globalization and localization techniques
How we implement web farm and web garden concept in asp.net?
What is the full meaning of asp.net?
How does ASP.NET framework maps client side events to Server side events.?
Does the following statement executes successfully: Response.Write(?value of i = ? + i);
How do we access view state value of this page in the next page?