Ejemplo n.º 1
0
        /// <summary>
        /// Gets or sets the item for the given skill array index and level
        /// </summary>
        /// <param name="skillArrayIndex"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public T this[int skillArrayIndex, int level]
        {
            get
            {
                Enforce.Argument(level > 0 && level <= 5, "level", "Level mut be greater than 0 and lesser or equal than 5.");
                return(m_items[skillArrayIndex * 5 + level - 1]);
            }
            set
            {
                Enforce.Argument(level > 0 && level <= 5, "level", "Level mut be greater than 0 and lesser or equal than 5.");
                var oldValue = m_items[skillArrayIndex * 5 + level - 1];

                if (value.Skill == null)
                {
                    m_count--;
                }
                else if (oldValue == null || oldValue.Skill == null)
                {
                    m_count++;
                }
                m_items[skillArrayIndex * 5 + level - 1] = value;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Implementses the specified obj.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="obj">The obj.</param>
 /// <returns></returns>
 public static T Implementation <T>(object obj) where T : class
 {
     return(Enforce.Implementation <T>(obj, String.Empty));
 }