摘要: 首先我必须承认访问一个类的私有成员不是什么好做法。大家也都知道私有成员在外部是不能被访问的。而一个类中会存在很多私有成员:如私有字段、私有属性、私有方法。对于私有成员访问,可以套用下面这种非常好的方式去解决。private string name;public string Name{ get { return name; } set { name = value; }} 但是有时候,源代码是别人的,你就不能修改源代码,只提供给你dll。或者你去维护别人的代码,源代码却有丢失。这样的情况如果你想知道私有成员的值,甚至去想直接调用类里面的私有方法。那怎么办呢?其实在.net中访问私有成员不是很难 阅读全文
posted @ 2012-12-14 22:12 shuangyihaiying 阅读(7650) 评论(2) 推荐(2) 编辑
摘要: 1、使用Assembly类定义和加载程序集,加载在程序集清单中列出模块,以及从此程序集中查找类型并创建该类型的实例。2、使用MethodInfo了解方法的名称、返回类型、参数、访问修饰符(如pulic 或private)和实现详细信息(如abstract或virtual)等。使用Type的GetMethods或GetMethod方法来调用特定的方法。反射的作用: 1. 可以使用反射动态地创建类型的实例,将类型绑定到现有对象,或从现有对象中获取类型 2. 应用程序需要在运行时从某个特定的程序集中载入一个特定的类型,以便实现某个任务时可以用到反射。 3. 反射主要应用与类库,这些类库需要知道一个类 阅读全文
posted @ 2012-12-14 07:31 shuangyihaiying 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 1.不显示第一个空白列RowHeaderVisible属性设置为false2.点击cell选取整行SelectinModel属性FullRowSelectRowSelectinModel属性设置或用CellClick事件也可以//整行选取privatevoiddataGridView1_CellClick(objectsender,DataGridViewCellEventArgse){//e.RowIndex>-1否则点击header也是叫一列if(dataGridView1.Rows.Count>0&&e.RowIndex>-1){//MessageBox 阅读全文
posted @ 2012-12-14 07:26 shuangyihaiying 阅读(375) 评论(0) 推荐(0) 编辑
摘要: 解决方法:具体操作: 打开 开始-程序-Microsoft Visual Studiio 208-Visual Studio Tools-Visual Studio 2008 命令提示 录入devenv /resetskippkgs执行即OK 阅读全文
posted @ 2012-12-11 18:46 shuangyihaiying 阅读(574) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ComponentModel; using System.Collections;using System.Diagnostics;using System.Windows.Forms;using System.Drawing;using System.Drawing.Drawing2D;namespace Project{ [ToolboxItem(true)] public partial... 阅读全文
posted @ 2012-12-11 11:44 shuangyihaiying 阅读(3693) 评论(0) 推荐(0) 编辑
摘要: public string NoHtml(string html) { string StrNohtml = System.Text.RegularExpressions.Regex.Replace(html, "<[^>]+>", ""); StrNohtml = System.Text.RegularExpressions.Regex.Replace(StrNohtml, "&[^;]+;", ""); return StrNohtml; } 阅读全文
posted @ 2012-12-11 11:39 shuangyihaiying 阅读(187) 评论(0) 推荐(0) 编辑
摘要: function checkValue() { if(isNaN($("#txt_name").val())) { alert("请用数字录入!"); return false; }}//无刷新时间 function ShowTime() { var data = new Date; document.getElementById("time").innerHTML = data.getFullYear()+"/"+(data.getMonth()+1)+"/"+data.getDate()+& 阅读全文
posted @ 2012-12-04 09:43 shuangyihaiying 阅读(163) 评论(0) 推荐(0) 编辑
摘要: http://www.nowamagic.net/librarys/veda/detail/2322 阅读全文
posted @ 2012-11-23 17:57 shuangyihaiying 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1.如果每次进入页面的时候都查询数据库生成页面内容的话,如果访问量非常大,则网站性能会非常差。而如果只有第一次访问的时候才查询数据库生成页面内容,以后都直接输出内容,则能提高系统性能。这样无论有多少人访问都只访问一次数据库,数据库压力不变。2.缓存(Cache)是一种用空间换取时间的技术,存在于计算机中很多地方,用来将一些慢速设备中的常用数据保存在快速设备中,取数据的时候直接从快速设备中取。比如CPU二级缓存、内存、windows文件读取缓存。3.缓存存在失效的问题:为了保证从缓存中读取数据和慢速数据(数据库)中数据一致,则需要在慢速数据(数据库)中对应的数据发生变化的时候,清除缓存中相应的数 阅读全文
posted @ 2012-11-06 15:27 shuangyihaiying 阅读(1172) 评论(0) 推荐(0) 编辑
摘要: string StrNohtml = System.Text.RegularExpressions.Regex.Replace(html, "<[^>]+>", ""); StrNohtml = System.Text.RegularExpressions.Regex.Replace(StrNohtml, "&[^;]+;", ""); return StrNohtml; 阅读全文
posted @ 2012-10-29 10:27 shuangyihaiying 阅读(158) 评论(0) 推荐(0) 编辑