Home » C# Programming » Generics

For the code snippet given below, which of the following statements is valid? public class Generic { public T Field; } class Program { static void Main(string[ ] args) { Generic g = new Generic(); g.Field = "Hello"; Console.WriteLine(g.Field); } }

Correct Answer: It will print string "Hello" on the console.

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion