/// <summary> /// gets the auto constant definition using an index into the auto constant definition array. /// If the index is out of bounds then false is returned; /// </summary> /// <param name="idx">The auto constant index</param> /// <param name="def"></param> /// <returns></returns> public static bool GetAutoConstantDefinition( int idx, out AutoConstantDefinition def ) { def = new AutoConstantDefinition(); if ( idx < AutoConstantDictionary.Length ) { // verify index is equal to acType // if they are not equal then the dictionary was not setup properly Debug.Assert( (AutoConstantType)idx == AutoConstantDictionary[ idx ].AutoConstantType ); def = AutoConstantDictionary[ idx ]; return true; } else return false; }
/// <summary> /// Gets the auto constant definition associated with name if found else returns false /// </summary> /// <param name="name">The name of the auto constant</param> /// <param name="def"></param> /// <returns></returns> public static bool GetAutoConstantDefinition( string name, out AutoConstantDefinition def ) { // find a constant definition that matches name by iterating through the // constant definition array def = new AutoConstantDefinition(); bool nameFound = false; int i = 0; int numDefs = AutoConstantDictionary.Length; while ( !nameFound && ( i < numDefs ) ) { if ( name == AutoConstantDictionary[ i ].Name ) nameFound = true; else ++i; } if ( nameFound ) def = AutoConstantDictionary[ i ]; return nameFound; }