c#字典可以找到类型的hashset< enum>
private Dictionary<HashSet<Flags>, int> dict;
使用Unity Inspector迭代该词典在开始时填充了字典,
public enum Flags
{
flag1,
flag2,
flag3
}
该字典确认它包含用于访问的相同的标签,但尝试使用密钥访问始终返回KeynotFoundException。用containsKey
手动测试也返回false。
private Dictionary<HashSet<Flags>, int> dict;
The dictionary is populated at Start using the Unity inspector
public enum Flags
{
flag1,
flag2,
flag3
}
Iterating the dictionary confirms it contains the same hashset being used to access, but attempting to access with the key always returns a KeyNotFoundException. Manually testing with ContainsKey
also returns false.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,默认情况下,.net通过参考比较类,例如,
如果要通过 value 进行比较,则应实现
iequalityComparer&lt; t&gt;
接口:并使用它:并使用:
Well, .Net by default compare classes by references, e.g.
If you want to compare by values, you should implement
IEqualityComparer<T>
interface:And use it: