Examveda

In the following C# code, which statements are perfectly valid?
public class Csharp
{
    public void subject<S>(S arg)
    {
        Console.WriteLine(arg);
    }
}
class Program
{
    static Void Main(string[] args)
    {
        Csharp c = new Csharp();
        c.subject("hi");
        c.subject(20);
    }
}

A. Run time exception error

B. Compile time error

C. Code runs successfully and prints required output

D. None of the mentioned

Answer: Option C


Join The Discussion

Related Questions on Delegates and Events in C Sharp