Im working on a Blazor app and I implemented some classes that have inheritance. When I create a Derived Class object it works fine and I can access and set all the values that it inherited from the Base Class, but when I hit a breakpoint and use the debugger to inspect the object, it only shows the properties that are in the derived class.
Whats happening?
Classes:
public class Event {
public int Id { get; set; }
[Required]
public string Title { get; set; }
[Required]
public DateTime Start { get; set; }
[Required]
public DateTime End { get; set; }
}
public class Shift :Event{
//[Required]
public ShiftRepeat Repeat { get; set; }
//[Required]
public List<Break> Breaks { get; set; }
public Shift ShallowCopy() {
return (Shift)this.MemberwiseClone();
}
}
Element Debugger is inspecting
var n = new Shift() {
Id = 1,
Title = "Shift 1",
Start = new DateTime(2021, 1, 18, 8, 0, 0),
End = new DateTime(2021, 1, 18, 16, 0, 0),
Repeat = ShiftRepeat.Daily,
Breaks = new List<Break>() {
new Break() {
Id = 1,
Title = "Lunch",
Start = new DateTime(2021, 1, 18, 12, 0, 0),
End = new DateTime(2021, 1, 18, 12, 30, 0)
}
}
};
Debugger inspection
One Drive File Download
question from:
https://stackoverflow.com/questions/65850088/inherited-properties-not-visible-in-debugger-blazor 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…