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

本文介绍了一个名为ArrayUtility的库的使用方法,该库提供了一系列针对数组的操作,包括求最小值、最大值、总和及平均值等。文章通过示例展示了如何将此库集成到Web应用程序中,并给出了具体的C#代码示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

下载一个ArrayUtility.dll:http://download.youkuaiyun.com/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.youkuaiyun.com/source/206381

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值