二维数组取最大数
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string dt1 = "2008-10-15 09:09:09";
string dt2 = "2008-10-10 10:09:09";
string dt3 = "2008-10-17 09:09:09";
string dt4 = "2008-10-13 09:09:09";
string[,] shijian = new string[4, 2] { { dt1, "yiqifa" }, { dt2, "linktech" }, { dt3, "heima" }, { dt4,"chengguo"} };
int max = 0;
DateTime dt = Convert.ToDateTime(shijian[0, 0]);
for (int i = 1; i < shijian.GetLength(0); i++)
{
if ( dt > Convert.ToDateTime(shijian[i, 0]))
{
continue;
}
else
{
dt = Convert.ToDateTime(shijian[i, 0]);
max = i;
}
}
Response.Write(shijian[max, 1].ToString());
}
}
![](http://www.google.cn/intl/zh-CN/images/logo_cn.gif)