string array.Contains?

前端 未结 10 1444
无人及你
无人及你 2021-02-07 03:22

.NET 2

string[] myStrings = GetMyStrings();    
string test = \"testValue\";

How can I verify if myStrings contains test

10条回答
  •  爱一瞬间的悲伤
    2021-02-07 04:10

    Thought I would add another to the mix, first available in .NET 3.5, I believe:

    Enumerable.Contains(myStrings.ToArray(), test)
    

提交回复
热议问题