コード例 #1
0
        /// <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;
            }
        }
コード例 #2
0
 /// <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]);
 }