Hi all,
I have a method like this: void m1(string str)
and have a class like this:
public class MyClass
{
public bool b1 { set; get; }
//and other properties
}
Now why following code does not cause compile error?
IClass2 _class2 = new Class2();
MyClass c1 = new MyClass();
_class2.m1("abcdef" + c1);
When I debug it, I realized that c1.ToString()
has been passed to m1
. Why this automatic .ToString()
has been occurred? The only thing I could say is that m1 has been defined in IClass2
interface and has been implemented by Class2
.