Example #1
0
        /// <summary>Creates a Gender from a int.
        /// A return value indicates whether the creation succeeded.
        /// </summary>
        /// <param name="val">
        /// A int describing a Gender.
        /// </param>
        /// <param name="result">
        /// The result of the creation.
        /// </param>
        /// <returns>
        /// True if a Gender was created successfully, otherwise false.
        /// </returns>
        public static bool TryCreate(int?val, out Gender result)
        {
            result = Gender.Empty;

            byte b = 0;

            if (!val.HasValue || FromInt32s.TryGetValue(val.Value, out b))
            {
                result = new Gender {
                    m_Value = b
                };
                return(true);
            }
            return(false);
        }
Example #2
0
 /// <summary>Returns true if the val represents a valid Gender, otherwise false.</summary>
 public static bool IsValid(int?val)
 {
     return(val.HasValue && FromInt32s.ContainsKey(val.Value));
 }
Example #3
0
 /// <summary>Returns true if the val represents a valid Gender, otherwise false.</summary>
 public static bool IsValid(int?val) => val.HasValue && FromInt32s.ContainsKey(val.Value);