In VB.NET I am trying to determine in a given string exists in a String Array. According to my research the Array has a 'Contains' method that I can use, so the Code looks something like this:
Dim fileTypesZ As String() = {"PDF", "TXT", "DOC", "DOCX", "XLS", "XLSX", "JPG", "JPGE", "BMP", "GIF"}
If (fileTypesZ.Contains(tempTest)) Then
End If
However, VB.NET is saying 'Contains' is not a member of 'System.Array'. Is there another method that I can use?
There is no Contains
on Array
, but there is Enumerable.Contains
, which is an extension method that works on arrays.
Make sure to include Imports System.Linq
at the top of your file, and that you're referencing System.Core.dll
in your project references.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With