我需要检查特定的字符串包含了一系列其他的:
I need to check that specific string contains in the set of others:
private bool Contains(string field)
{
return this.Fields.Contains(field); // HashSet<string> local property
}
什么是容器的最佳类型使用,如果只有一个任务呢? - 把若干个字符串,并检查是否另一个是进入或不
What is the best type of container to use if only one task of it - to hold a number of strings and check does another one is into or does not?
是的,HashSet的是为这个完美的,因为它包含一个值来查找不像字典,需要一个键和一个值。
Yes, HashSet is perfect for this since it contains one value to look up unlike a Dictionary which requires a key and a value.