System.Globalization.CCGregorianEraHandler.ValidEra C# (CSharp) Method

ValidEra() public method

The method tests, whether the era number does exist.
public ValidEra ( int era ) : bool
era int An integer giving the era number. ///
return bool
	public bool ValidEra(int era) {
		return _Eras.Contains((System.Object)era);
	}
} // class CCGregorianEraHandler

Usage Example

Esempio n. 1
0
 /// <summary>
 /// A protected method checking the era number.
 /// </summary>
 /// <param name="era">The era number as reference. It is set
 /// to <see cref="F:CurrentEra"/>, if the input value is 0.</param>
 /// <exception name="T:System.ArgumentException">
 /// The exception is thrown if the era is not supported by the class.
 /// </exception>
 internal void M_CheckEra(ref int era)
 {
     if (era == CurrentEra)
     {
         era = KoreanEra;
     }
     if (!M_EraHandler.ValidEra(era))
     {
         throw new ArgumentException("Era value was not valid.");
     }
 }