What is generic
What is generic in C#.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Oct 9, 2012, 7:38 AM
Please refer the below links
http://msdn.microsoft.com/en-us/library/512aeb7t.aspx
http://www.c-sharpcorner.com/UploadFile/jgodel/Page102062006170216PM/Page1.aspx
http://www.csharp-station.com/Tutorial/CSharp/Lesson20
Thanks
Sivaraman DhamodaranPosted Oct 9, 2012, 7:22 AM
AddNumbers(int a, int b);
AddNumbers(float a, float b);
AddNumbers(double a, double b);
We have three overloaded function that do Addition.
Now have a look AddNumbers(T a, T b);
Here T is called Generic Type.
And the function is called Generic Function as it can be called by AddNumbers(2,3) as well as AddNumbers(2.6, 7,4);
By using generic, you can avoid overloaded functions and multiple delcarations (Case A).