System.Array does not contain a definition for 'Any' - C#

后端 未结 3 1221
旧巷少年郎
旧巷少年郎 2021-01-24 04:14

Using Visual Basic // C#

I\'m trying to search through my stored arrays for a match to the user input. For example, the user has stored the data for a USB, and now wish

3条回答
  •  温柔的废话
    2021-01-24 04:29

    Any() is an extension method in System.Linq namespace. You have to add using System.Linq; so that you can use it.

    namespace Your.Namespace
    {
        using System;
        using ... // your other usings
        using System.Linq;
    
        public sealed class YourClass
        {
            public void Test()
            {
                // ...
                yourArray.Any()
            }
        }
    }
    

提交回复
热议问题