ChengKing

ChengKing

  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  1 随笔 :: 49 文章 :: 0 评论 :: 0 Trackbacks

using System;

namespace Array操作
{
 /// <summary>
 /// Class1 的摘要说明。
 /// </summary>
 class Class1
 {
  /// <summary>
  /// 应用程序的主入口点。
  /// </summary>
  [STAThread]
  static void Main(string[] args)
  {
   //
   // TODO: 在此处添加代码以启动应用程序
   //
   String[] friends=new String[]{"2mojian","1zhengjian","3xugang","4guoyonghui"};
   Console.WriteLine("操作前数组数据为:");
   foreach(string index in friends)
   {
    Console.Write(index+" ");
   }
   Array.Sort(friends);
   Console.WriteLine("\n排序后的数据为:");
   for(int i=friends.GetLowerBound(0);i<=friends.GetUpperBound(0);i++)
   {
    Console.Write(friends[i]+" ");
   }
   Array.Reverse(friends);
   Console.WriteLine("\n逆序后的数据为:");
   for(int i=friends.GetLowerBound(0);i<=friends.GetUpperBound(0);i++)
   {
    Console.Write(friends[i]+" ");
   }
   Console.WriteLine();
   Console.Read();
  }
 }
}

posted on 2005-11-06 12:27 ZhengJian 阅读(427) 评论(0)  编辑 收藏 引用 所属分类: C#专栏C#之Collection探讨
只有注册用户登录后才能发表评论。