2017年12月29日

[转载]回调函数

摘要: //定义主函数,回调函数作为参数 function A(callback) { alert("我是主函数"); callback(); } //定义回调函数 function B() { alert("我是回调函数");//模仿耗时操作 } A(B); //调用主函数,将函数B传进去 //输出结果 阅读全文

posted @ 2017-12-29 16:40 New_q 阅读(86) 评论(0) 推荐(0) 编辑

aspx.cs调用js方法

摘要: //如果有UpdatePanel就用如下代码调用前台js // ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "Ceshi();", true); //如果没有就如下代码 this.Page.Cl 阅读全文

posted @ 2017-12-29 14:23 New_q 阅读(440) 评论(0) 推荐(0) 编辑

计算字符串中每种字母出现的次数

摘要: string msg = "WebApplication2"; msg = msg.ToLower(); Dictionary<char, int> dict = new Dictionary<char, int>(); for (int i = 0; i < msg.Length; i++) { 阅读全文

posted @ 2017-12-29 11:52 New_q 阅读(226) 评论(0) 推荐(0) 编辑

[转载]获取2个集合List<T>的共同元素

摘要: List<int> a = new List<int> { 1, 2, 3, 4, 5, 6 }; List<int> b = new List<int> { 1, 21, 13, 14, 15, 61 }; List<int> c = a.Intersect(b).ToList(); foreac 阅读全文

posted @ 2017-12-29 11:47 New_q 阅读(116) 评论(0) 推荐(0) 编辑

导航