When.com Web Search

Search results

  1. Results From The WOW.Com Content Network
  2. How do I check if a value is in an array in C#? Like, I want to create an array with a list of printer names. These will be fed to a method, which will look at each string in turn, and if the string is the same as a value in an array, do that action.

  3. This doesn't only work for strings - you can use this trick to check if an array of any type contains any element, as long as the element's class implements IComparable. Keep in mind not all IList<T> methods work this way.

  4. Array.Exists<T>(T[], Predicate<T>) Method (System)

    learn.microsoft.com/en-us/dotnet/api/system.array.exists

    Determines whether the specified array contains elements that match the conditions defined by the specified predicate.

  5. How to Check if an Array Contains a Value in C# | Delft Stack

    www.delftstack.com/howto/csharp/check-for-an-element-inside-an-array-in-csharp

    Array.IndexOf() and Array.Contains() are straightforward and easy to use, providing the index and existence of an element, respectively. Array.FindIndex() and Array.Find() offer flexibility for more complex conditions and scenarios where the actual element is needed.

  6. C# String Array Contains - Stack Overflow

    stackoverflow.com/questions/44916954

    In first case, you call String.Contains which checks if string contains substring. So, this condition returns true . In the second case, you call Enumerable.Contains on string[] which checks if string array contains a specific value.

  7. Enumerable.Contains Method (System.Linq) | Microsoft Learn

    learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.contains

    The following code example demonstrates how to use Contains<TSource>(IEnumerable<TSource>, TSource) to determine whether an array contains a specific element.

  8. C# | Check if an array contain the elements that match the...

    www.geeksforgeeks.org/c-sharp-check-if-an-array-contain-the-elements-that...

    It return true if array contains one or more elements that match the conditions defined by the specified predicate. Otherwise, return false . Exception: This method will give ArgumentNullException if the value of array is null, or if the value of match is null.

  9. How to check if an array contains a specific element in C# - C#...

    www.c-sharpcorner.com/article/how-to-check-if-an-array-contains-a-specific...

    Sometimes, you may need to check whether an array contains a specific element. To check whether an array contains a specific element in C#, you can use the Contains method, which is part of the LINQ (Language Integrated Query) extension methods for the Enumerable interface.

  10. C# Array Contains: Checking if an Element Exists in Array - Web...

    www.webdevtutor.net/blog/c-sharp-systemarray-contains

    In C#, you can easily determine if an element exists in an array by using the System.Array.Contains method. This method helps you efficiently check for the presence of a specific value within an array.

  11. How to Check if a C# Array Contains a Specific Value - Web Dev...

    www.webdevtutor.net/blog/c-sharp-array-contains-value

    One of the simplest ways to check if a value is present in an array is by using the Contains method provided by the System.Linq namespace. This method returns true if the specified value is found in the array, and false otherwise.