Reproduction:
Snippet 1:
class A{
A(int i){}
A(string s){}
A(Form b){}
A(Stream b){}
//...more constructors but no one accepts object type
}
Snippet 2:
A assign(object obj)
{
dynamic d=obj;
//do something with d or obj?
A a=new A(d);
return a;
}
How to make the line A a=new A(d); working?
Edit:
How to make the line A a=new A(d); working without dynamic type mechanism?
Add A(object obj){}
To A’s constructor, then use GetType() to identify it.