A cosa si Inheritedriferisce la proprietà bool sugli attributi?
Significa che se definisco la mia classe con un attributo AbcAtribute(che ha Inherited = true), e se eredito un'altra classe da quella classe, anche la classe derivata avrà lo stesso attributo applicato?
Per chiarire questa domanda con un esempio di codice, immagina quanto segue:
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
public class Random: Attribute
{ /* attribute logic here */ }
[Random]
class Mother
{ }
class Child : Mother
{ }
Fa Childanche Randoml'attributo applicato ad esso?
Inheritedproprietà ha un esempio elaborato che mostra la differenza traInherited=trueeInherited=falsesia per una classe ereditata che per unoverridemetodo.