language-enhancement

Do you think “auto interface implementation” would be useful in .NET / C# [closed]

ぃ、小莉子 提交于 2019-12-03 20:14:45
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . Consider this: public class interface Person : IPerson { int ID { get; protected set; } string FirstName { get; set; } string LastName

Do you think “auto interface implementation” would be useful in .NET / C# [closed]

半城伤御伤魂 提交于 2019-11-30 15:32:10
Consider this: public class interface Person : IPerson { int ID { get; protected set; } string FirstName { get; set; } string LastName { get; set; } string FullName { get { return FirstName + " " + LastName; } } } And this: public class StubPerson : IPerson { int ID { get { return 0; protected set { } } string FirstName { get { return "Test" } set { } } string LastName { get { return "User" } set { } } string FullName { get { return FirstName + " " + LastName; } } } Usage: IPerson iperson = new Person(); Or: IPerson ipersonStub = new StubPerson(); Or: IPerson ipersonMock = mocks.CreateMock