假如我有一个dll中封装了如下函数和接口。
public interface Myinterfance
{
string Msg
{
get;
}
}
public class ShowMe
{
public static void MessageBox(ref Myinterfance k)
{
System.Windows.Forms.MessageBox.Show(k.Msg);
}
}
我现在要调用ShowMe.MessageBox()函数,我使用的方法是:
public class Class1:Myinterfance
{
public Class1()
{
}
public string Msg
{
get
{
return "hello world";
}
}
}
ShowMe.MessageBox(ref new Class1())但编译无法通过,请问这个问题如何解决?
public interface Myinterfance
{
string Msg
{
get;
}
}
public class ShowMe
{
public static void MessageBox(ref Myinterfance k)
{
System.Windows.Forms.MessageBox.Show(k.Msg);
}
}
我现在要调用ShowMe.MessageBox()函数,我使用的方法是:
public class Class1:Myinterfance
{
public Class1()
{
}
public string Msg
{
get
{
return "hello world";
}
}
}
ShowMe.MessageBox(ref new Class1())但编译无法通过,请问这个问题如何解决?
Myinterfance a = new Class1();
ShowMe.MessageBox(ref a);看看可不可以