MySql.Data.MySqlClient.MySqlParameterCollection.AdjustHash C# (CSharp) Method

AdjustHash() private static method

private static AdjustHash ( Hashtable hash, string parameterName, int keyIndex, bool addEntry ) : void
hash System.Collections.Hashtable
parameterName string
keyIndex int
addEntry bool
return void
    private static void AdjustHash(Hashtable hash, string parameterName, int keyIndex, bool addEntry)
    {
      if (!hash.ContainsKey(parameterName)) return;
      int index = (int)hash[parameterName];
      if (index < keyIndex) return;
      hash[parameterName] = addEntry ? ++index : --index;
    }

Usage Example

 private void AdjustHashes(int keyIndex, bool addEntry)
 {
     for (int i = 0; i < this.Count; i++)
     {
         string parameterName = this.items[i].ParameterName;
         MySqlParameterCollection.AdjustHash(this.indexHashCI, parameterName, keyIndex, addEntry);
         MySqlParameterCollection.AdjustHash(this.indexHashCS, parameterName, keyIndex, addEntry);
     }
 }