由网友(风华笔墨、)分享简介:我想给一个字符串许多字符串比较。如何在C#中做呢?I want to compare one string with many strings. How is that done in C#?推荐答案如果你想检查一个字符串包含在一个字符串列表,你可以使用的 包含 扩展方法:If you want to chec...
我想给一个字符串许多字符串比较。如何在C#中做呢?
I want to compare one string with many strings. How is that done in C#?
推荐答案
如果你想检查一个字符串包含在一个字符串列表,你可以使用的 包含
扩展方法:
If you want to check if a string is contained in a list of strings you could use the Contains
extension method:
bool isStringContainedInList =
new[] { "string1", "string2", "string3" }.Contains("some string")
相关推荐
最新文章