Collection -> Array的排序(正序/逆序)
2006-12-15 18:15
369 查看
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();
}
}
}
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();
}
}
}
相关文章推荐
- Collection -> Array的排序(正序/逆序)
- Collection -> Array的排序(正序/逆序)
- Collection -> Array的排序(正序/逆序)
- 数组排序方法的性能比较(2):Array.Sort<T>实现分析
- C#数组的排序(正序逆序)
- 一起谈.NET技术,数组排序方法的性能比较(中):Array.Sort<T> 实现分析
- Collection -> 用SortedList实现排序
- Ext.util.MixedCollection-->排序,克隆,过滤
- Flex ArrayCollection 中的排序、过滤
- c语言实现直接插入排序(正序和逆序)
- Flex ArrayCollection 排序
- C# Hashtable 正序和逆序排序
- 前台JQuery绑定和后台绑定 区分 +JS单引号和双引号调用函数区分+ 正序,逆序排序想法
- C# Hashtable 正序和逆序排序
- map正序、逆序排序
- Collection -> 用SortedList实现排序
- Flex ArrayCollection 之排序
- 【JavaScript 学习--02】--排序问题(正序和逆序)
- 艾伟_转载:数组排序方法的性能比较(中):Array.Sort<T> 实现分析
- List<Object>使用Object的某个属性进行排序(正序,倒序)