摘要: class Program { static void Main(string[] args) { int obj = 2; Test<int> test = new Test<int>(obj); Console.WriteLine("int:" + test.obj); string obj2 = "hello world"; Test<string> te... 阅读全文
posted @ 2010-04-12 16:08 qinyi 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 高效C#的习惯。。。。。。。。。。。。。。。。。。。1:Foreach比For高效,只有其30%的时间花费。2:避免使用ArrayList,因为其装箱拆箱频繁,建议使用泛型。3:使用HashTable替代其他字典集合类型。4:StringBuilder代替字符串连接符“+”。5:用String.Compare进行比较。6:避免在循环体内声明变量,应该在循环体外声明变量,在循... 阅读全文
posted @ 2010-03-24 00:19 qinyi 阅读(244) 评论(0) 推荐(0) 编辑
摘要: Model:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceMaticso... 阅读全文
posted @ 2010-03-23 23:28 qinyi 阅读(241) 评论(0) 推荐(0) 编辑
摘要: select getdate() 2004-09-12 11:06:08.177 整理了一下SQL Server里面可能经常会用到的日期格式转换方法: 举例如下: select CONVERT(varchar, getdate(), 120 ) 2004-09-12 11:06:08select replace(replace(replace(CONVERT(varchar, getdate(),... 阅读全文
posted @ 2010-03-23 14:27 qinyi 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1:POSTtry { var xmlhttp = new XMLHttpRequest(); } catch (e) { var xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } xmlhttp.open("POST", "AjaxUpdate.aspx", false); xmlhttp.setRequestHeader("Content-... 阅读全文
posted @ 2010-03-22 18:58 qinyi 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 1.ClientScript.RegisterStartupScript(GetType(),"message","<script>alert('第一种方式,无白屏!');</script>");2.HttpContext.Current.Response.Write("<script>alert('第二种方式,有白屏!')</script>");3... 阅读全文
posted @ 2010-03-22 18:45 qinyi 阅读(22573) 评论(0) 推荐(0) 编辑
摘要: 一. 使用QueryString变量    QueryString是一种非常简单也是使用比较多的一种传值方式,但是它将传递的值显示在浏览器的地址栏中,如果是传递一个或多个安全性要求不高或是结构简单的数值时,可以使用这个方法。 Response.Redirect( "target.aspx?param1=hello&param2=hi ") 接收页面: string str = Reque... 阅读全文
posted @ 2010-03-22 18:33 qinyi 阅读(207) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Collections;namespace DAL //可以修改成实际项目的命名空间名称{ /// ... 阅读全文
posted @ 2010-03-22 17:54 qinyi 阅读(2473) 评论(0) 推荐(1) 编辑
摘要: using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Collections;namespace DAL //可以修改成实际项目的命名空间名称{ /// ... 阅读全文
posted @ 2010-03-22 17:53 qinyi 阅读(589) 评论(0) 推荐(0) 编辑
摘要: 为了达到不同的显示效果有时,我们需要对时间进行转化,默认格式为:2007-01-03 14:33:34 ,要转化为其他格式,要用到 DateTime.ToString的方法(String, IFormatProvider),如下所示: using System; using System.Globalization; String format="D"; DateTime date=DataTim... 阅读全文
posted @ 2010-03-22 17:52 qinyi 阅读(147) 评论(0) 推荐(0) 编辑