Exemplo n.º 1
0
        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>( ));
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
 public static IEnumerable <object> Objects(this IBehaviorsContainer bc)
 {
     return(bc.Behaviors.Objects);
 }
Exemplo n.º 4
0
 public static void Set(this IBehaviorsContainer bc, IBehavior behavior)
 {
     bc.Behaviors.Set(behavior);
 }