/// <summary> /// Sets a permutation. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="parameter"></param> /// <param name="value"></param> public void Set <T>(PermutationParameter <T> parameter, T value) { if (!EqualityComparer <T> .Default.Equals((T)ObjectValues[parameter.BindingSlot], value)) { PermutationCounter++; } ObjectValues[parameter.BindingSlot] = value; }
/// <summary> /// Sets a permutation. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="parameter"></param> /// <param name="value"></param> public void Set <T>(PermutationParameter <T> parameter, T value) { bool isSame = EqualityComparer <T> .Default.Equals((T)ObjectValues[parameter.BindingSlot], value); if (!isSame) { PermutationCounter++; } // For value types, we don't assign again because this causes boxing. if (!typeof(T).IsValueType || !isSame) { ObjectValues[parameter.BindingSlot] = value; } }
/// <summary> /// Gets a permutation. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="parameter"></param> /// <returns></returns> public T Get <T>(PermutationParameter <T> parameter) { return((T)ObjectValues[parameter.BindingSlot]); }