Reputation: 5821
I have:
public interface ITest
{
string test { get; set; }
}
And
[DataContract]
public class TestGeneric : ITest
{
[DataMember]
public string test;
}
But i keep getting the error: 'TestGeneric' does not implement interface member 'ITest.Test'
on TestGeneric
in the public class TestGeneric : ITest
line of code. Would someone be able to explain why this is?
Upvotes: 4
Views: 6314
Reputation: 29836
You have created a field, as you omitted the { get; set; }
accessors that make a member a property.
The implementation must match the interface exactly, so add those accessors:
public class TestGeneric : ITest
{
public string Test { get; set; }
}
Upvotes: 9