I'm a C# newbie and am trying to implement an interface. I know I can't put access modiefiers onto interface methods so how do I get access to 'TestValue' in the public static 'Create' method of 'TestClass2' below? the error I get is...
'TestClass1' does not contain a definition for 'TestValue' and no extension method 'TestValue' accepting a first argument of type 'TestClass1' could be found
public interface IParent
{
string TestValue { get; }
}
public class TestClass1 : IParent
{
string IParent.TestValue
{
get { return "hello"; }
}
}
public class TestClass2
{
private string _testValue;
public static TestClass2 Create(TestClass1 input)
{
TestClass2 output = new TestClass2();
output._testValue = input.TestValue;
return output;
}
}