Value type (struct
) can implement interface. It cannot inherit another struct
, but can implement interface.
Structs can implement an interface but they cannot inherit from another struct. For that reason, struct members cannot be declared as protected.
So when you have a struct
which implements IInterface
and you do following:
var value = new MyStruct();
var valueAsInterface = (IInterface)value;
valueAsInterface
contains reference to a boxed value of a value type that implements that interface type.