Reputation: 538
I have and array and i want to check if my Dim value is contains in array but i need to check if it appears twice.
Example:
Dim value as String = "AST"
Dim zone_check_list() As String = {"AMST","AST","AST","EET","EDT"}
'if "AST" appeared twice then i will show message box
Upvotes: 0
Views: 825
Reputation: 89285
How about using LINQ :
Imports System.Linq
Dim value as String = "AST"
Dim zone_check_list() As String = {"AMST","AST","AST","EET","EDT"}
Dim isAppearTwice As Boolean = (zone_check_list.Count(Function(x) x = value) = 2)
Console.WriteLine(isAppearTwice)
Upvotes: 3