07 2013 档案
摘要:答案是属性先被赋值。原因是为什么? public ActionResult Test() { Person p=new Person(); return Json(5, JsonRequestBehavior.AllowGet); } public class Person { public string Id { get; set; } public int Name { get { retur...
阅读全文
摘要:join方法publicstaticIEnumerable Join( thisIEnumerable outer, IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector)中outerKeySelector是指要参与比较的第一个序列的元素,innerKeySelector是指要参与比较的第二个序列的元素,Func resultSelector常用一个匿名函数作为透射出来的结果集,重载方法的最后一个参数IEqualityComparer则是这两个元素的默认比较器。示例代码:clas
阅读全文
摘要:在使用上传功能时,IEnumerable attachments 中IE会获取attachment.FileName的文件路径全名,因此,为了消除浏览器区别,需要使用string fileName = Path.GetFileName(file.FileName);来统一获取文件的名字。
阅读全文
摘要:项目中很多界面都要用到批量删除,于是把其提到layout所引用的js中,并改为如下代码:var isAllSelect = false;$(function () { $("#selectAllChB").click(function () { //注册全选按钮 if (isAllSelect == true) { isAllSelect = false; $("input[id^='CHECKBOX-']").each(function () { $(this).attr("checked", ...
阅读全文
摘要:样例: IWorkbook workbook; string fileExt = Path.GetExtension(filePath); try { using (var file = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { if (fileExt == ".xls") { ...
阅读全文
摘要:public void Test() { var arr1=new[]{1,2,3}; var arr2 = arr1; var arr3 = (int[])arr1.Clone(); //浅拷贝 arr1[0] = 4; //arr2[0]已改变为4,arr3[0]未改变 var arr4 = new[] { new Person(),new Person(),new Person() }; var arr5 = arr4; var arr6 = (Person[])arr4.Clone(); arr4[0].Id = 2; // //arr5[0].Id已改变为"2",
阅读全文
摘要:某个类所处的程序集的地址:string assemblyPath=Assembly.GetAssembly(typeof(InitialsFilter)).Location用反射创建类的实例var instance=(Interface)Assembly.LoadFrom(assemblyPath).CreateInstance(className),其中className为类的全名,即命名空间.类名
阅读全文
摘要:直接后代选择器:>.grid>input[type="button"]所有后代选择器:空格.grid input[type="button"]选择器分组:,.grid,.rule
阅读全文

浙公网安备 33010602011771号