一个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; 求助!求助一个获取文件路径的问题 求救VB和C#都通的高手!! C#中解决二进制流byte[]的循环读出问题? 想写个统计自写代码(非ide生成)的小工具,大家指点。 100分---DbDataAdapter.Update时的输出参数如何获得? 如何判定其他进程对文件的写操作是否已经结束? GetProcessesByName调用无法实现 问一些问题...... 如何获取SQL数据库中某个表属性中的最后更新时间 c# 中怎么同时获取多个按钮事件 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;