Binary Search array - CSharp System

CSharp examples for System:Array Search

Description

Binary Search array

Demo Code


using System.Linq;
using System.Collections.Generic;
using System;// w w w  . j a v  a 2s . c  o  m

public class Main{
        public static int
        BinarySearch<T>(this T[] array, int index, int length, T value, IComparer<T> comparer) {
            return Array.BinarySearch(array, index, length, value, comparer);
        }
        public static int
        BinarySearch<T>(this T[] array, int index, int length, T value) {
            return Array.BinarySearch(array, index, length, value);

        }
        public static int
        BinarySearch<T>(this T[] array, int index, int length, object value) {
            return Array.BinarySearch(array, index, length, value);

        }
        public static int
        BinarySearch<T>(this T[] array, T value, IComparer<T> comparer) {
            return Array.BinarySearch(array, value, comparer);

        }
        // Static Array Methods

        public static int
        BinarySearch<T>(this T[] array, T value) {
            return Array.BinarySearch(array, value);

        }
}

Related Tutorials