How to call a method in another class from a generic method? <p>Why doesn't the line marked with <code>//Dont work in the bottom of the code</code> compile?</p> <p>I want to reuse the <code>WriteMessage</code> method with different Classes, I try to use <code>generics</code>, but I'm not sure how to use it.</p> <pre><code>class ClassOne { public string MethodOne() { return ("ClassOne"); } public string MethodTwo() { return ("ClassOne -MethodTwo "); } } class ClassTwo { public string MethodOne() { return ("ClassTwo"); } public string MethodTwo() { return ("ClassOne -MethodTwo "); } } class Program { private static void Main() { var objectOne = new ClassOne(); WriteMessage(objectOne); var objectTwo = new ClassTwo(); WriteMessage(objectTwo); Console.ReadKey(); } public static void WriteMessage&lt;T&gt;(T objectA) { var text = objectA.MethodTwo(); //Dont Work Console.WriteLine("Text:{0}", text); } } </code></pre>