Hi,
I just gone through following link
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=120
read following code lines. However following code is fine I guess because function MyMethod not initialise any variable. Although you declare MyInterface obj= new MyStruct(); still it will work. Please comment.
interface MyInterface
{
void MyMethod();
}
struct MyStruct : MyInterface
{
public void MyMethod()
{
Console.WriteLine("Struct Method from MyStruct");
Console.ReadLine();
}
}
class Class1
{
[STAThread]
static void Main(string[] args)
{
MyInterface obj= new MyStruct();
obj.MyMethod();
}
}