KimhillZhang  
上一页 1 2 3 4 5 6 7 ··· 16 下一页

2013年4月10日

摘要: 贴一个简单的代码1:多线程public class Class1 { public Class1() { Timer timer = new Timer(); timer.Enabled = true; timer.Interval = 500; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); Console.Read(); } int n = 0; void timer_Elapsed(object sender, ElapsedEventArgs e) { n++; System.Threading.Thread t = n 阅读全文
posted @ 2013-04-10 11:27 KimhillZhang 阅读(395) 评论(0) 推荐(0) 编辑

2013年3月20日

摘要: 对于javascript函数重载这个概念,参考书籍上多多少少都会提及,也就是从语言角度来说,javascript不支持函数重载,不能够定义同样的函数然后通过编译器去根据不同的参数执行不同的函数。但是javascript却可以通过自身属性去模拟函数重载。书上常见的比较无意义的例子,比如一个计算器函数,如果参数为两个数字,就执行加法运算。如果参数为三个数字,就执行乘法运算这个函数大家最容易想到的实现就是function calculate() { if (arguments.length == 2) { return arguments[0] + arguments[1]; } if (argu. 阅读全文
posted @ 2013-03-20 15:14 KimhillZhang 阅读(331) 评论(0) 推荐(0) 编辑
 
摘要: 不想写太多的方法名,网上百度的:JavaScript 语言的方法声明中,不能明确指定参数的类型和个数,所以不能实现方法的重载,但是我们可以用其他的方法来实现重载的效果。在 JavaScript 的方法内,有个叫做 arguments 的变量数组,它是只读的,所有实际传入的参数变量都 放在了里面,通过它,我们可以对传入的参数进行类型检查,从而实现重载的效果。判断一个变量的类型有两种方法用 typeof 语句: function check(){ if(typeof arguments[0] == 'string') alert('你传入的参数是个字符串'); el 阅读全文
posted @ 2013-03-20 15:06 KimhillZhang 阅读(673) 评论(0) 推荐(0) 编辑

2013年2月3日

摘要: BOOL=System.Int32 BOOLEAN=System.Int32 BYTE=System.UInt16 CHAR=System.Int16 COLORREF=System.UInt32 DWORD=System.UInt32 DWORD32=System.UInt32 DWORD64=System.UInt64 FLOAT=System.Float HACCEL=System.IntPtr HANDLE=System.IntPtr HBITMAP=System.IntPtr HBRUSH=System.IntPtr HCONV=System.IntPtr HCONVLIST=Sys 阅读全文
posted @ 2013-02-03 10:55 KimhillZhang 阅读(437) 评论(1) 推荐(0) 编辑

2013年1月23日

摘要: 早上看到了instanceof,之前没有使用过,于是百度了。资料还非常多。。自已落伍了啊。。网上看了几篇,复制下来,方便以后学习。复制网址就不贴了哈,各个看到一样的请多多包含。。typeof 是一个一元运算,放在一个运算数之前,运算数可以是任意类型。它返回值是一个字符串,该字符串说明运算数的类型。typeof 一般只能返回如下几个结果:number,boolean,string,function,object,undefined。我们可以使用 typeof 来获取一个变量是否存在,如 if(typeof a!="undefined"){alert("ok" 阅读全文
posted @ 2013-01-23 09:05 KimhillZhang 阅读(384) 评论(0) 推荐(1) 编辑

2013年1月17日

摘要: var url = "http://www.xxx.com/index.aspx?classid=9&id=2";要获取尾巴参数定义变量function parse_url(_url){//定义函数var pattern = /(\w+)=(\w+)/ig;//定义正则表达式var parames = {};//定义数组url.replace(pattern, function(a, b, c){ parames[b] = c;}); /*这是最关键的.当replace匹配到classid=9时.那么就用执行function(a,b,c);其中a的值为:classi 阅读全文
posted @ 2013-01-17 15:15 KimhillZhang 阅读(787) 评论(1) 推荐(0) 编辑

2013年1月8日

摘要: 如图:实现效果:添加了多条数据到ListView列表里,在下面的文本框也对应添加“指令名称”,当我删除列表里的一要数据时(可能多条),在下面的文本框也对应删除对应的文本(文本框的显示顺序与列表不一致)。我想把删除列表的某条数据写成一个公共的方法,在方法删除时,对应的文本框文本也删除。所以想到的是用yield return.代码如下:公共方法:public static System.Collections.IEnumerable DeleteListItem(this ListView lv) { int n = lv.SelectedItems.Count; if (n > 0) { 阅读全文
posted @ 2013-01-08 10:27 KimhillZhang 阅读(481) 评论(0) 推荐(0) 编辑

2012年12月19日

摘要: 今天碰到这样的问题比如:public void main(){ object _var = new{ start = 1, end = 100 }; getMain(_var);}public void getMain(object _v){ //在这里我怎么获取,得到 start = 1, end = 100 ??????????}程序调用: main();后来找到方法://先定义一个方法public T CastByAnonToObject<T>(object obj, Func<T> value){ return (T)obj;}//然后public void g 阅读全文
posted @ 2012-12-19 20:47 KimhillZhang 阅读(691) 评论(4) 推荐(0) 编辑
 
摘要: 要删除的字符串ID为:string SDSALES_IDString = 1,2,3,4,5,6,7//转成ArrayArray array = SDSALES_IDString.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToArray<string>();在模型定义一个 public ArraySDSALES_IDs {get;set;}XML:<delete id="DeleteManyT_LABEL_SDSALES" parameterCl 阅读全文
posted @ 2012-12-19 20:31 KimhillZhang 阅读(353) 评论(0) 推荐(0) 编辑

2012年11月22日

摘要: 今天在winform上需要上传,删除服务器上的文件,网上找了下上传是很多,可删除没有找到答案,,最后只能拿个土办法实现了,这里是用ashx文件来处理上传:B/Spublic void ProcessRequest(HttpContext context) { foreach (string fileKey in context.Request.Files) { try { HttpPostedFile file = context.Request.Files[fileKey]; string oldFileName = file.FileName; //原文件名 xxx.jpg int ex. 阅读全文
posted @ 2012-11-22 17:00 KimhillZhang 阅读(3399) 评论(1) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 16 下一页