VB.net Program to Demonstrate the Binarysearch() Method of Array Class

VB.Net program to demonstrate the BinarySearch() method of Array class

'VB.NET program to demonstrate the BinarySearch() 
'method of Array class.

Imports System

Module Module1
    Sub Main()
        Dim index As Integer
        Dim arr() As Integer = {10, 20, 30, 40, 50}

        index = Array.BinarySearch(arr, 30)

        If (index < 0) Then
            Console.WriteLine("Item not found")
        Else
            Console.WriteLine("Item {0} find at index: {1}", 30, index)
        End If
    End Sub
End Module
Item 30 find at index: 2
Press any key to continue . . .
Share on:

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Comment