Example #1
0
        /// <summary>
        /// Gets the registered value of the specified type for this <see cref="SridItem"/>. Users are generally expected to pass their own enum types.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public T?Id <T>() where T : struct, Enum
        {
            int n = SridRegister.GetIdType <T>();

            object v = (n < _idMap.Count) ? _idMap[n] : null;

            if (v is T t)
            {
                return(t);
            }
            else
            {
                return(null);
            }
        }