Unlike classes, a struct
is a value type, and is created on the local stack and not on the managed heap, by default. This means that once the specific stack goes out of scope, the struct
is de-allocated. Contained reference types of de-allocated struct
s are also swept, once the GC determines they are not longer referenced to by the struct
.
struct
s cannot inherit and cannot be bases for inheritance, they are implicitly sealed, and also cannot include protected
members. However, a struct
can implement an interface, as classes do.