Tengo problemas con la implementación automática de C# de la 'NotImplementedException' en las propiedades implementadas automáticamente siempre que las generé.
Esta es la clase de interfaz:
public interface IPerson { string Name {get;set;} int Age {get; set;} char Gender {get; set;} string Email {get;set;} string Address {get;set;} }Esta es la clase derivada. Es el método de implementación automática 'NotImplementedException' cada vez que intento implementar la interfaz en la clase derivada.
public class Student : IPerson { public Student() { } public string Name { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public int Age { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public char Gender { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public string Email { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } public string Address { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } }¿Hay alguna manera de hacer que los métodos de acceso en la clase Student no se implementen automáticamente con 'NotImplementedException' cuando implemento y genero los miembros desde la interfaz IPerson?
La selección de prefer auto properties implementará propiedades en las interfaces con solo get o set en lugar de lanzar NotImplementedException s
Así es como se ve la configuración en VS 2022