我有:
public interface ITest
{
string test { get; set; }
}
和
[DataContract]
public class TestGeneric : ITest
{
[DataMember]
public string test;
}
但我不断收到错误消息:'TestGeneric' 没有在
代码行。有人能解释这是为什么吗?public class TestGeneric 中的
: ITestTestGeneric
上实现接口(interface)成员 'ITest.Test'
最佳答案
您已经创建了一个字段,因为您省略了 { get;放;
使成员成为属性的访问器。
实现必须与接口(interface)完全匹配,所以添加那些访问器:
public class TestGeneric : ITest
{
public string Test { get; set; }
}
关于c# - 不实现接口(interface)成员问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27826391/