--list集合中有一个模型,根据里面某一个字段排序:
list = list.OrderByDescending(m => m.CreateTime).ToList();
--把list集合进行分页:
int count = list.Count;
if (pageIndex <= 0 || count < pageSize)
{
//不足一页时
pageList = list.OrderBy(c => c.FileName).Take(pageSize).ToList();
}
else
{
pageList = list.OrderBy(c => c.FileName).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList();
}
--会产生随机数0-9999
Random random =new Random();
string num = random.Next(0, 10000).ToString();
--获取毫秒
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
DateTime d = sdf.Parse(time);
int taskTime = d.Millisecond;//毫秒
--JS中对URL进行编码
var fileName = escape(url) ;