在DataGridView中點擊過爭吵後,我把兩個單元格的值,在此行中:哪裏存儲兩個值進一步比較?
string id = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["Number"].Value);
string type = Convert.ToString(dataGridView1.Rows[e.RowIndex].Cells["dataGridViewTextBoxColumn46"].Value);
因此,在這種結構來存儲這些值,也進一步起飛呢?
結果我需要比較id, type
是否存在於結構中。我想試試Dictionary<int, int>
。但是,很難以檢查是否有值在字典這樣的:Dictionary<'id', 'type'>
可能解釋是正確的方法,那麼我應該使用'if(dict.ContainsKey(key)&& dict.ContainsValue(value)){...}'? – OPV
'Tuple'或'ValueTuple'是你的朋友。 –
它可以作爲數組 []的元組嗎? –
OPV