public int GetContextStateInt <T>(bool global, int defaultVal) where T : ContextIntState { ContextIntState countState = global ? GlobalContextStates.GetWithDefault <T>() : ContextStates.GetWithDefault <T>(); if (countState == null) { return(defaultVal); } else { return(countState.Count); } }
public void AddContextStateInt <T>(int addedVal) where T : ContextIntState { ContextIntState countState = ContextStates.GetWithDefault <T>(); if (countState == null) { T newCount = (T)Activator.CreateInstance(typeof(T)); newCount.Count = addedVal; ContextStates.Set(newCount); } else { countState.Count += addedVal; } }
protected ContextIntState(ContextIntState other) { Count = other.Count; }