Il presente articolo è stato tradotto automaticamente. Passare il puntatore sulle frasi nell'articolo per visualizzare il testo originale. Ulteriori informazioni.
Traduzione
Originale
Questo argomento non è stato ancora valutato - Valuta questo argomento

Metodo DataGridCell.GetHashCode

Ottiene un valore hash che può essere aggiunto a un oggetto Hashtable.

Spazio dei nomi:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
public override int GetHashCode()

Valore restituito

Tipo: System.Int32
Un numero che identifica in modo univoco DataGridCell in Hashtable.

Nell'esempio seguente viene aggiunto il valore hash della cella selezionata in un controllo System.Windows.Forms.DataGrid controllare a un oggetto Hashtable.


private Hashtable myHashTable = new Hashtable();

private void Grid_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
   DataGrid dg = (DataGrid)sender;
   DataGridCell myCell = dg.CurrentCell;
   string tempkey = myCell.ToString();
   Console.WriteLine("Temp " + tempkey);
   if(myHashTable.Contains(tempkey)){return;}
   myHashTable.Add(tempkey, myCell.GetHashCode());
   Console.WriteLine("Hashcode: " + myCell.GetHashCode().ToString());
}
      


.NET Framework

Supportato in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supportato in: 4, 3.5 SP1

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (ruoli di base del server non supportati), Windows Server 2008 R2 (ruoli di base del server supportati con SP1 o versione successiva, Itanium non supportato)

.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Il documento è risultato utile?
(1500 caratteri rimanenti)

Aggiunte alla community

AGGIUNGI
© 2013 Microsoft. Tutti i diritti riservati.