[b]在C#中怎用接口方法[/b]
在C#中怎用接口方法
工程1、即接口工程ITest,容如下:
namespace ITest
{
public interface Interface1
{
string ReturnString();
}
}
工程2、即方法工程BLLTest,容如下:(在此工程中引用ITest.dll)
using ITest;
namespace BLLTest
{
public class BLLTest:Interface1
{
public string ReturnString()
{
return "OK";
}
}
}
工程3、即用界面工程UITest,容如下:(在此工程中引用了ITest.dll)
using ITest;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
//不知怎么了,助
ClsForm1.Interface1 a = ........
MessageBox.Show(ClsForm1.Interface1.ReturnString());
}
}
}
[解决办法]