Array: Binary Search, Copy : Array Search « Data Structure « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Data Structure » Array SearchScreenshots 
Array: Binary Search, Copy
Array: Binary Search, Copy
   
Imports System
Imports System.Collections

Public Class MainClass
   Shared Private integerValues As Integer() {123456}

   Shared Private integerValuesCopy(6As Integer

   Public Shared Sub Main()
      Dim result As Integer

      Console.WriteLine("Initial Array Values:" )
      PrintArray()

      Array.Copy(integerValues, integerValuesCopy,integerValues.Length)

      Console.WriteLine("Array values after Copy:" )

      PrintArray() 

      result = Array.BinarySearch(integerValues, 5)

      If result >= Then
         Console.WriteLine("5 found at element " & result )
      Else
         Console.WriteLine("5 not found" " in integerValues")
      End If

   End Sub
   Shared Private Sub PrintArray()
      Dim integerElement As Integer

      For Each integerElement In integerValues
         Console.WriteLine(integerElement )
      Next

      Console.WriteLine(" integerValuesCopy: ")

      For Each integerElement In integerValuesCopy
         Console.WriteLine(integerElement )
      Next

   End Sub

End Class


           
         
    
    
  
Related examples in the same category
1.Array.Find<(Of <(T>)>),
2.Array.FindLast<(Of <(T>)>)
3.Array.FindAll<(Of <(T>)>)
4.Array.Exists<(Of <(T>)>)
5.Array.TrueForAll<(Of <(T>)>)
6.All three generic overloads of the Array.IndexOf method.
7.Searches an entire one-dimensional sorted Array for a specific element
8.Searches sorted Array for a specific element, using the IComparable(Of T) generic interface
9.Searches sorted Array for a value using the specified IComparer(Of T) generic interface.
10.Searches for an element that matches the conditions defined by the specified predicate
11.Searches for an element that matches the conditions
12.Searches for the object and returns the index of the first occurrence
13.Searches for the first occurrence of the duplicated value in the last section of the Array
14.Searches for the first occurrence of the duplicated value in a section of the Array
15.Array.IndexOf(T) searches for the object and returns the index of the first occurrence
16.Searches for the object and returns the index of the last occurrence
17.Searches for the last occurrence of the duplicated value in the first section of the Array.
18.Searches for the last occurrence of the duplicated value in a section of the Array.
19.Array.LastIndexOf(T) searches for the specified object and returns the index of the last occurrence
20.Determines whether an array contains elements
21.Array.FindLastIndex
w_w__w_.___j___a_v___a__2___s_.___c__o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.