一个整形(Integer)数组(Array)的Utility

首先去我的资源中心:http://download.csdn.net/user/insus/

下载一个ArrayUtility.dll:http://download.csdn.net/source/203944

把这个ArrayUtility.dll Add Reference到你的Web site的Bin folder中

然后可以在page中,using(C#)或Imports(vb.net)一个名称空间:Insus.NET

下面是一个C# Sample:

cs:

using System;
using System.Data;
using System.Configuration;
using System.Linq;
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;
using System.Xml.Linq;
using Insus.NET; // 引用名称空间

public partial class _Default:System.Web.UI.Page
... {
ArrayUtilityobjArrayUtility
=newArrayUtility();//new一个实例

protectedvoidPage_Load(objectsender,EventArgse)
...{
int[]arr=...{3,54,89,12,8,56,97,33,38};

this.lblMin.Text=objArrayUtility.Minimum(arr).ToString(); //最小元素
this.lblMax.Text=objArrayUtility.Maximun(arr).ToString(); //最大元素
this.lblSum.Text=objArrayUtility.Sum(arr).ToString(); //和
this.lblAverage.Text=objArrayUtility.Average(arr).ToString();//平均值
}

}

html:

Min: < asp:LabelID = " lblMin " runat = " server " Text = "" ></ asp:Label >< br />
Max:
< asp:LabelID = " lblMax " runat = " server " Text = "" ></ asp:Label >< br />
Sum:
< asp:LabelID = " lblSum " runat = " server " Text = "" ></ asp:Label >< br />
Average:
< asp:LabelID = " lblAverage " runat = " server " Text = "" ></ asp:Label >< br />

最后你可以下载应用视频:

http://download.csdn.net/source/206381

你可能感兴趣的:(Web,UI,asp.net,asp,LINQ)