If you create a sealed class, you also will not receive a warning (because a problem is only a problem if you inherit this class and redefine the member).
Edit after OP comment:
Ah, right. I usually only encounter this when dealing with inherited virtual members. Yads' answer is probably most useful to you.
Also note that you do not need to do the entire virtual property. Consider this:
List<Grade> Grades { get { return _grades; } set { _grades = value; OnGradesChanged(); } protected virtual OnGradesChanged() { }
Usually you do not want to store Grades differently in a derived class. You just need to do some updating when it changes. In this way, you provide additional guidance to the derived class, and you are sure that you can trust the scope of support.
PS Do you know that people can edit List<Grade> if your classes do not see it? You should use an ObservableCollection , which triggers an event when the collection changes externally. In this case, you only need to open the readonly Grades property.
user180326
source share