RoboZhando/CommandNext/Query.cs
/// <summary>
/// Validates strictly if we only have the keys passed. If we do not have all the keys, or if we have extra keys, this will return false.
/// </summary>
/// <param name="keys">The keys we only want</param>
/// <returns>True if we only have those keys.</returns>
Validates strictly if we only have the keys passed. If we do not have all the keys, or if we have extra keys, this will return false.
Validates strictly if we only have the keys passed . If we do not have all the keys or if we have extra keys this will return false .
public bool ValidateStrict(params string[] keys)
        {
            if (keys.Length != this.Count) return false;
            List<string> remain = new List<string>(keys);
            foreach (string key in this.Keys)
            {
                if (!remain.Contains(key))
                    return false;
                remain.Remove(key);
            }
            return remain.Count == 0;
        }
public bool ValidateStrict ( params string [ ] keys ) { if ( keys . Length != this . Count ) return false ; List < string > remain = new List < string > ( keys ) ; foreach ( string key in this . Keys ) { if ( ! remain . Contains ( key ) ) return false ; remain . Remove ( key ) ; } return remain . Count == 0 ; }
Validates strictly if we only have the keys passed.
Validates strictly if we only have the keys passed .
//We are not matching in length, no way will we have the keys //We are a key we where not expecting! //Remove it from the remaining keys to expect
True if we only have those keys.
True if we only have those keys .
keys
The keys we only want
The keys we only want