一个LIST<INT>型,里面有N个数,求最大数为多少,并把它赋给一个LABLE.TEXT中 一个LIST<INT>型,里面有N个数,求最大数为多少,并把它赋给一个LABLE.TEXT中 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 tryList<int> list = new List<int>(new int[] { 1, 5, 6, 8, 2, 7, 3, 15, 9, 0 });list.Sort();label1.Text = list[list.Count-1].ToString(); List<int> list = new List<int>(new int[] { 1, 5, 6, 8, 2, 7, 3, 15, 9, 0 });list.Sort();label1.Text = list[list.Count-1].ToString(); lz 也确实挺懒的 查查msdn 就知道List<int> list = new List<int>(new int[] { 1, 5, 6, 8, 2, 7, 3, 15, 9, 0 });list.Sort();label1.Text = list[list.Count-1].ToString(); 代码是MSDN提供的?有效率吗?难道为了拿到一个最大值, 对整个LIST排序-次? -_-#...List<int> list = new List<int>(new int[] { 1, 5, 6, 8, 2, 7, 3, 15, 9, 0 });int result = list[0];foreach (int i in list){ if (i > result) result = i;}label1.Text = "最大值为:" + result; .net2008 安装mvc1.0问题 弹出另一个窗体,关闭本身这个窗体 想做个分销系统,大家给点建议,C/S?B/S? VS2008在结束调试时会假死怎么办? 下载直接变成播放 [求助]提示的窗体怎么做? 在类或命名空间“WindowsApplication1.Form1”中不存在? C#中关于验证码的问题 请大家帮忙,如何在程序中提交一个 form 请问VS.NET的企业结构版、企业开发版、专业版的区别在哪里? SQL连接两个表 关于java和c#的小问题.跪求各位大哥帮忙....
List<int> list = new List<int>(new int[] { 1, 5, 6, 8, 2, 7, 3, 15, 9, 0 });
list.Sort();
label1.Text = list[list.Count-1].ToString();
list.Sort();
label1.Text = list[list.Count-1].ToString();
lz 也确实挺懒的 查查msdn 就知道List<int> list = new List<int>(new int[] { 1, 5, 6, 8, 2, 7, 3, 15, 9, 0 });
list.Sort();
label1.Text = list[list.Count-1].ToString();
有效率吗?
难道为了拿到一个最大值, 对整个LIST排序-次?
List<int> list = new List<int>(new int[] { 1, 5, 6, 8, 2, 7, 3, 15, 9, 0 });
int result = list[0];
foreach (int i in list)
{
if (i > result)
result = i;
}label1.Text = "最大值为:" + result;