-
I think an example will be enough public interface ITest
{
protected string _name { get; set; }
public string Name { get => _name; set => _name = value; }
}
public class Test : ITest
{
public string _name { get; set; } = "e";
public Test()
{
Console.WriteLine(((ITest)this).Name); // Works!
Console.WriteLine(Name); // Compilation error???
// Symbol "Name" doesnt exist in current context
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
CREAsTIVE
Jan 8, 2024
Replies: 1 comment 2 replies
-
This is a C# language question. Interfaces implemented by a class isn't "parent" like base class. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh sorry, wrong repository... Should i go to https://github.com/dotnet/csharplang/discussions?