
.Net
火山码哥
专注
展开
-
使用 DataAdapter 执行批量更新
在以前版本的 ADO.NET 中,使用 DataSet 中的更改来更新数据库时,DataAdapter 的 Update 方法每次更新数据库的一行。因为该方法循环访问指定 DataTable 中的行,所以,会检查每个 DataRow,确定是否已修改。如果该行已修改,将根据该行的 RowState 属性值调用相应的 UpdateCommand、InsertCommand 或 DeleteComman原创 2008-12-10 23:35:00 · 454 阅读 · 0 评论 -
C#异步调用四大方法详解
<br />C#异步调用四大方法是什么呢?C#异步调用四大方法的使用是如何进行的呢?让我们首先了解下什么时候用到C#异步调用:<br />.NET Framework 允许您C#异步调用任何方法。定义与您需要调用的方法具有相同签名的委托;公共语言运行库将自动为该委托定义具有适当签名的 BeginInvoke 和 EndInvoke 方法。<br />BeginInvoke 方法用于启动C#异步调用。它与您需要异步执行的方法具有相同的参数,只不过还有两个额外的参数(将在稍后描述)。BeginInvoke 立即转载 2010-08-21 11:11:00 · 666 阅读 · 0 评论 -
.Net反射的常用类
1、 TypeDescriptor类:通过反射获取对象的属性列表,通过GetValue(),SetValue()进行属性赋值。好处:自动匹配相同的属性名进行赋值,不需要硬编码指定属性名。 /// /// 将来源对象的属性值复制到目的对象的对应属性。【规则:属性名相同。属性类型相同】 /// p原创 2009-10-08 10:02:00 · 839 阅读 · 0 评论 -
C#与IronPython脚本进行数据交互示例
单单执行脚本是没有什么意思的,最重要的是嵌入的脚本能和宿主语言进行交互,下面我就讲讲这方面的实现。 IronPython脚本最优秀的地方就是与C#(或者说.net框架集)几乎无缝集成,C#实现的类很容易就传入到脚本中去。(目前唯感遗憾的是,IronPython脚本还没有支持嵌入版,希望不远的的将来能实现嵌入式版本)。 这是宿主语言的代码: pu转载 2009-10-06 00:25:00 · 588 阅读 · 0 评论 -
微软bug解决方法:System.ObjectDisposedException: 无法访问已释放的对象。对象名:“Icon”
在WINFORM开发中,对当打开多个MDI窗体,并且在最大化状态下关闭窗体时,常常出现以下异常:System.ObjectDisposedException: 无法访问已释放的对象。对象名:“Icon”。 在 System.Drawing.Icon.get_Handle() 在 System.Drawing.Icon.get_Size() 在 System.Drawing.Icon原创 2009-09-29 15:03:00 · 23764 阅读 · 3 评论 -
数据绑定常见问题
1、两个GRID绑定父子关系的数据源绑定。如果先新增子数据源记录,则会出现异常:System.MissingMethodException: Constructor on type System.ComponentModel.IBindingList not found.at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingA原创 2009-07-09 15:15:00 · 931 阅读 · 0 评论 -
IO常用操作
1、打开选中的文件夹并指向选中的文件System.Diagnostics.Process.Start("explorer.exe", "/select," + filePath);原创 2009-07-06 16:17:00 · 418 阅读 · 0 评论 -
在当前按钮位置弹出窗体的代码。自动计算弹出方位。
private void button_Click(object sender, System.EventArgs e) { string data = "data" Form f = new Form(); try { int topx = this.Parent.PointToScreen(this.Location).X; int topy = this.P原创 2009-07-23 09:29:00 · 650 阅读 · 0 评论 -
.NET Runtime Optimization Service解释
原文引自:http://blogs.msdn.com/davidnotario/archive/2005/04/27/412838.aspxWhat is mscorsvw.exe and why is it eating up my CPU? What is this new CLR Optimization Service?Short version:mscorsvw.exe转载 2008-12-25 13:44:00 · 21069 阅读 · 0 评论 -
[C#]Enum枚举类型使用总结
public enum Colors { Red = 1, Green = 2, Blue = 4, Yellow = 8 }; The entries of the Colors Enum are:RedGreenBlueYellow根据name获得Enum的类型:Colors mycolor = (Colors)Enum.Parse(typeof(Colors),"red",true);(in原创 2008-12-25 13:42:00 · 2708 阅读 · 0 评论 -
WinGrid Performance Guide
REF: http://news.infragistics.com/forums/t/15306.aspx The purpose of this article is to provide some general programming practice guidelines and troubleshooting tips to improve performance whe转载 2008-12-21 02:30:00 · 1477 阅读 · 0 评论 -
关于c#中的消息处理函数和vc中的消息处理函数区别
从vc入门编程的,相信大家都很熟悉PreTranslateMessage和WindowProc两个函数,前者是预处理windows发给控件的消息,后者是处理剩余的控件消息。对于PreTranslateMessage函数,一般来说,我们是这样处理控件消息的:BOOL test::PreTranslateMessage(MSG* pMsg) {if(pMsg->hwnd==GetSafeHwnd(转载 2009-03-05 15:51:00 · 960 阅读 · 0 评论 -
performance optimization in C#
1. Used always sealed classes when the class havent any derived classes.Some additional infos from this point:The sealed modifier is primarily used to prevent unintended derivation, but it also ena转载 2008-12-10 22:24:00 · 605 阅读 · 0 评论 -
使用开源免费类库在.net中操作Excel
自从上次找到NPOI之后,根据园友提供的线索以及Google,又找到了一些开源免费的类库,所以都简单体验了一遍。主要找到以下类库:MyXls(http://sourceforge.net/projects/myxls/)Koogra(http://sourceforge.net/projects/koogra/)ExcelLibrary(http://code.google.com/p转载 2012-01-30 16:31:06 · 1099 阅读 · 0 评论