public static T Get <T>(this IBehaviorsContainer bc) where T : IBehavior { if (bc is BehaviorsContainerBase bcb && !bcb.LazyBehaviors.IsInitialized) { throw new ArgumentException($"no behavior of type {typeof( T )} set"); } return(bc.Behaviors.Get <T>( )); }
public static bool TryGet <T>(this IBehaviorsContainer bc, out T behavior) where T : IBehavior { if (bc is BehaviorsContainerBase bcb && !bcb.LazyBehaviors.IsInitialized) { behavior = default; return(false); } return(bc.Behaviors.TryGet(out behavior)); }
public static IEnumerable <object> Objects(this IBehaviorsContainer bc) { return(bc.Behaviors.Objects); }
public static void Set(this IBehaviorsContainer bc, IBehavior behavior) { bc.Behaviors.Set(behavior); }