随笔分类 -  c#

摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.IO;using System.Security.Cryptography;namespace ConsoleApp{ class Program { static void Main(string[] args) { Dictionary<string, string> parameters = new Dic... 阅读全文
posted @ 2012-09-11 16:30 大约 阅读(361) 评论(0) 推荐(0) 编辑
摘要:protected void Page_Load(object sender, EventArgs e) { //泛型Dictionary Dictionary<string, string> dit = new Dictionary<string, string>(); dit.Add("13", "张三"); dit.Add("22", "李四"); Response.Write("总数" + dit.Count + "<br/>"); 阅读全文
posted @ 2012-04-17 11:21 大约 阅读(6619) 评论(0) 推荐(0) 编辑
摘要:推荐C#程序员,在ASP.NET中使用 Microsoft.JScript.GlobalObject.encodeURIComponent("!@#$&*()=:/;?+'中 文");编码而不要使用Server.UrlEncode("!@#$&*()=:/;?+'中 文");在客户端用js方法decodeURIComponent()来解析;将不会出现"!@#$&*()=:/;?+'中 文"等符号不能解析的问题;对于服务器语言Server.UrlEncode("!@#$& 阅读全文
posted @ 2012-04-17 11:14 大约 阅读(470) 评论(0) 推荐(0) 编辑
摘要:$("#YourInputID").autocomplete("/Service/AutoComplete.aspx", { dataType: "json", parse: function(data) { var arr = []; for (var i = 0; i < data.length; i++) { arr.push({ data: data[i], value: data[i].text, result: data[i].text }); } ... 阅读全文
posted @ 2012-04-17 11:13 大约 阅读(936) 评论(0) 推荐(0) 编辑
摘要:在Asp.net MVc 2中由于对数据的保护,默认情况下request为post,所以在前端请求的时候则需要以post方式requestaction方法:public JsonResult GetPersonInfo() { var person =new { Name ="张三", Age =22, Sex ="男" }; return Json(person); }前端请求代码:$.ajax({ url: "/FriendLink/GetPersonInfo", type: "POST", dataType: 阅读全文
posted @ 2012-03-15 11:04 大约 阅读(423) 评论(0) 推荐(0) 编辑
摘要:1.用Pascal规则来命名方法和类型。(笔者注:单词首字母大写) publicclassDataGrid { publicvoidDataBind() { } } 2.用Camel规则来命名局部变量和方法的参数.(笔者注:首单词小写,其余单词首字母大写;笔者使用此方式命名成员变量) publicclassProduct { privatestring_productId; privatestring_productName; publicvoidAddProduct (stringproductId,stringproductName) { } } 补充:使用匈牙利方式命名局部变量,方法参数 阅读全文
posted @ 2012-02-27 23:15 大约 阅读(443) 评论(0) 推荐(0) 编辑
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;namespace Test{ class Program { static void Main(string[] args) { User u = new User(); u.name_ = "ytjjyy"; u.password_ = "XXXBBBCCCC"; ... 阅读全文
posted @ 2012-01-01 22:14 大约 阅读(287) 评论(0) 推荐(0) 编辑
摘要:public List<T> RetrieveHtmlInput(HtmlForm form) { List<T> list = new List<T>(); foreach (Control ctrl in form.Controls) { if (ctrl is T) { T control = (T)Convert.ChangeType(ctrl, typeof(T)); ... 阅读全文
posted @ 2012-01-01 13:48 大约 阅读(637) 评论(0) 推荐(0) 编辑
摘要:string[] ids = new string[]{10101,10005,10007};db.Profile.WhereNotIn(c => c.Id,ids); 阅读全文
posted @ 2011-12-27 21:57 大约 阅读(566) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示