Server.Race.Parse C# (CSharp) Méthode

Parse() public static méthode

public static Parse ( string value ) : Race
value string
Résultat Race
		public static Race Parse( string value )
		{
			CheckNamesAndValues();

			for( int i = 0; i < m_RaceNames.Length; ++i )
			{
				if( Insensitive.Equals( m_RaceNames[i], value ) )
					return m_RaceValues[i];
			}

			int index;
			if( int.TryParse( value, out index ) )
			{
				if( index >= 0 && index < m_Races.Length && m_Races[index] != null )
					return m_Races[index];
			}

			throw new ArgumentException( "Invalid race name" );
		}