gpt4 book ai didi

C# 在哈希表中查找键并收集相应的值

转载 作者:太空宇宙 更新时间:2023-11-03 21:28:35 25 4
gpt4 key购买 nike

谁能告诉我如何在哈希表中搜索特定键并将相应的值放到变量中(例如,键和值都来自 point 类)

我添加如下值:

Hashtable Hash = new Hashtable();     
Hash.Add(new Point(Po.X - 1, Po.Y), new Point(Po.X, Po.Y));

最佳答案

您可以使用以下内容:

Point value;
if (Hash.ContainsKey(YourKey))
{
value = (Point)Hash[YourKey];
}

关于C# 在哈希表中查找键并收集相应的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25404950/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com