日期:2014-05-18 浏览次数:20995 次
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] ch1 = { '1', '2', '3', '4', '5', '6', 'A', 'E' };
            char[] ch2 ={ '1','2', 'G', 'T', 'E', '3' };
            foreach (char c in ch2)
            {
                if (System.Array.BinarySearch(ch1, c) >= 0)
                {
                    Console.WriteLine("{0}在ch1的索引是{1}", c, System.Array.BinarySearch(ch1, c));
                }
                else
                {
                    Console.WriteLine("{0}没有在ch1中出现", c);
                }
            }
        }
    }
}