I have the following generic class:
class Foo<T>
{
//Constructor A
public Foo(string str)
{
Console.Write("A");
}
//Constructor B
public Foo(T obj)
{
Console.Write("B");
}
}
I want to create an instance of this class with T being a string
, using constructor B.
Calling new Foo<string>("Hello")
uses constructor A. How can I call constructor B (without using reflection)?