将值输入数组并使用代码对数组进行排序 [英] Enter values into array and sort the array using code
本文介绍了将值输入数组并使用代码对数组进行排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
如何将值输入数组并使用代码对数组进行排序..
任何人都会帮助?
hi
how to enter values into array and sort the array using code..
any one will help??
推荐答案
使用Array.Sort
方法.有关其各种方法参数,请参见此处 [ ^ ].
对于一个简单的示例,请访问此处 [
Use theArray.Sort
method. For its various method parameters, see here[^].
For a simple example, visit here[^].
使用Array.Sort()方法
use Array.Sort() method
static void Main()
{
string[] a = new string[]
{
"delhi",
"mbd",
"bly",
"rmp",
"gzb",
};
Array.Sort(a);
foreach (string s in a)
{
Console.WriteLine(s);
}
或者您可以在C#中使用排序算法
气泡在C#中排序
插入排序
欲了解更多信息,请尝试Google
or you can use sorting algorithm in C#
Bubble Sort in C#
Insertion sort
for more try Google
通过此链接
http://www.java2s.com/Code/CSharp/Collections-Data-Structure/SortandsearchanArrayList.htm [^ ]
它可能对您有帮助
go through this link
http://www.java2s.com/Code/CSharp/Collections-Data-Structure/SortandsearchanArrayList.htm[^]
it may help u
这篇关于将值输入数组并使用代码对数组进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文