现在的位置: 首页 > 综合 > 正文

c#基础

2013年07月02日 ⁄ 综合 ⁄ 共 498字 ⁄ 字号 评论关闭

//定义数组
string[] logs = new string[] { "Application", "Security", "System" };

 

//最具通用性和可变长数组ArrayList
ArrayList arr = new ArrayList();
arr.Add(1);
arr.Add(2);
arr.Add(3);

foreach (object i in arr)
{
    Response.Write(i.ToString());
}

 

//获取指定精度的除法结果.a为被除数,b为除数,c为精度
return Math.Round(a / b, c);

 

//根据记录总数和每页记录数获取页总数,常用于分页功能中
return (int)Math.Ceiling((double)recordTotal / pagesize);

 

//Web项目中获取当前程序所在的物理路径
Response.Write(HttpRuntime.AppDomainAppPath);

 

//Windows程序获取当前程序运行路径
string path = System.Windows.Forms.Application.StartupPath.ToString();

抱歉!评论已关闭.