我需要一個用于字節數組的HashSet,以便檢查集合中是否存在給定的字節數組。但似乎這不適用于字節數組(或任何數組)。這是我的測試代碼:void test(){ byte[] b1 = new byte[] { 1, 2, 3 }; byte[] b2 = new byte[] { 1, 2, 3 }; HashSet<byte[]> set = new HashSet<byte[]>(); set.Add(b1); set.Add(b2); Text = set.Count.ToString();//returns 2 instead of the expected 1.}有沒有一種方法可以為字節數組創建HashSet?
- 1 回答
- 0 關注
- 232 瀏覽
添加回答
舉報
0/150
提交
取消