C# Programming - Generics - Discussion
Discussion Forum : Generics - General Questions (Q.No. 5)
5.
For the code snippet shown below, which of the following statements are valid?
public class TestIndiaBix
{
public void TestSub<M> (M arg)
{
Console.Write(arg);
}
}
class MyProgram
{
static void Main(string[] args)
{
TestIndiaBix bix = new TestIndiaBix();
bix.TestSub("IndiaBIX ");
bix.TestSub(4.2f);
}
}
Discussion:
1 comments Page 1 of 1.
Srikanth said:
1 decade ago
It will take a default type as generic type. So if we pass int value in the generic method it will act as a int generic method.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers