【发布时间】:2014-02-25 11:37:41
【问题描述】:
我有一个名为 iChannels 的接口,它只有一个方法。
using CHNL;
namespace iInterface
{
public interface iChannels
{
string getData(string docXML);
}
}
然后在另一个项目中,我有一个名为 Channel1 的类,它的定义如下:
using iInterface;
namespace CHNL
{
public class Channel1:iChannels
{
string getData(string str)
{
return str;
}
}
}
我必须做一个交叉引用,因为接口和类是相互认识的。
之后我有一个网络表单,我只想使用using iInterface;,但如果我只这样做,我就无法创建 Channel1 对象。
我的意图是创建 Channel1 对象,只使用 iInterface Library。
【问题讨论】:
-
我不明白你的意思,但你确定这个
Channel1:iInterface不应该是Channel1:iChannels吗? Also1:您不能向接口添加对其实现类的引用。 Also2: 请定义I can't。您的代码中没有任何内容向我们展示您所描述的问题 - 那里没有交叉引用。 -
请遵守此处的 Microsoft 编码约定:msdn.microsoft.com/en-us/library/ff926074.aspx
-
CHNL 项目正在使用 iInterface,而 iInterface 正在使用 CHNL。这不是交叉引用?