private IEnumerable <T> GetStates(System.Type tp) { if (_isStatic) { this.SyncStates(); return(from s in _states where tp.IsAssignableFrom(s.GetType()) select s); } else { return(ParentComponentStateSupplier <T> .GetComponentsOnTarg(tp, _container, _includeStatesOnContainer)); } }
private IEnumerable <TSub> GetStates <TSub>() where TSub : class, T { if (_isStatic) { this.SyncStates(); return(from s in _states where s is TSub select s as TSub); } else { return(ParentComponentStateSupplier <T> .GetComponentsOnTarg <TSub>(_container, _includeStatesOnContainer)); } }
private void SyncStates() { if (_isStatic) { if (!_clean) { _states.Clear(); if (_container != null) { ParentComponentStateSupplier <T> .GetComponentsOnTarg(_container, _states, _includeStatesOnContainer); } _clean = true; } } else { _states.Clear(); if (_container != null) { ParentComponentStateSupplier <T> .GetComponentsOnTarg(_container, _states, _includeStatesOnContainer); } } }