随笔分类 - 01 [.NET 知识积累]
Hidden Methods - EditorBrowsable
摘要:Hidden Methods - EditorBrowsableRecently while exploring multi-threading with WPF, I came across a method on a WPF control's Dispatcher to check if the current thread has access to the control. myButton.Dispatcher.CheckAccess();Now, the funny thing about this method is that it is a public method
阅读全文
Make ObservableCollection to thread safe (Updated)
摘要:While playing around with WPF, I tried to do some multithreading where I have a worker thread updating my ObservableCollection, while having a ListCollectionView of that ObservableCollection being shown on a ListBox.It was surprising to see that I get a NotSupportedException thrown, with the messag.
阅读全文
Thread Synchronization 一 ManualResetEvent and AutoResetEvent
摘要:http://www.yoda.arachsys.com/csharp/threads/waithandles.shtmlWaitHandles - Auto/ManualResetEvent and MutexMonitor.Wait/Pulse isn't the only way of waiting for something to happen in one thread and telling that thread that it's happened in another. Win32 programmers have been using various ot
阅读全文
Thread safe - 深入理解lock
摘要:The lock and SyncLock Keywords1 ). Thread to start method with parameter, the method must be with object type parameter.2). The lock (C#) and SyncLock (Visual Basic) statements can be used to ensure that a block of code runs to completion without interruption by other threads. This is accomplished .
阅读全文
【xml]: Read XML with Namespace resolution using XLinq.XElement
摘要:http://www.codeproject.com/KB/linq/xelementns.aspxstringmyxml=@"<root><onexmlns:a='http://rediff.com'><a:oneonesequenceId='11'xmlns:b='http://yahoo.com'><b:id>1</b:id><b:name></b:name></a:oneone><a:twotwoxmlns:b='htt
阅读全文
【转】你必须知道的#if DEBUG
摘要:#if DEBUG,这个东东其实以前刚开始学习C#的时候就知道了,也知道怎么用,但就是没有使用过。随想,很多人估计也都没有用过吧(嘿,自我安慰下)。 最近看MVVMLight的代码时看到#if SILVERLIGHT的东东,于是想起来#if debug来了,于是在代码中疯狂的使用: 设置下用户名和密码,免得每次都输入 #if DEBUG UserID = "abc@abc.com"; Password = "123456"; #endif 设置下登陆状态,免得每次都要登陆 #if DEBUG IsLogin = true; #elif ...... #e
阅读全文
C#如何引用C++的代码
摘要:C++的Cpp文件#include<iostream>#defineMODULEAPI#include"tracewrite.h"usingnamespacestd;voidFunc1(){cout<<"iamfunction1"<<endl;}voidFunc2(){cout<<"iamfunction2"<<endl;}voidFunc3(){cout<<"iamfunction3"<<endl;}对应的头文件:(.h)#ifn
阅读全文
[转]《.NET4.0 面向对象编程漫谈》读书笔记 ——第10章 异步编程模式
摘要:http://www.cnblogs.com/laosu/archive/2011/05/23/2054491.html10章 异步编程模式【摘要】:异步编程充分利用多线程技术带来的好处,而不需要程序员了解多线程开发中的复杂细节。本章讲述了基于IAsyncResult的异步模式、基于事件的异步模式。 第1节 程序的同步执行和异步执行1、同步概念:若在代码中调用了一个方法,需要等待此方法所有的代码执行完毕之后,才能回到原来的地方执行下一行代码,这种程序运行方式称为同步。2、异步概念: 在调用方法之后,不用等待方法执行完成就马上执行下一条语句,这种程序运行方式称为异步。3、异步调用的本质:不在主.
阅读全文
DataGrid VirtualMode 动态加载数据
摘要:DataGrid VirtualMode View Code usingSystem;usingSystem.Data;usingSystem.Data.SqlClient;usingSystem.Drawing;usingSystem.Windows.Forms;namespaceWindowsFormsApplication8{publicpartialclassVirtualJustInTimeDemo:System.Windows.Forms.Form{privateDataGridViewdataGridView1=newDataGridView();privateCachememo
阅读全文
Loads the specified manifest resource from this assembly
摘要:View Code usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.IO;usingSystem.Reflection;usingSystem.Data.SqlClient;namespaceConsoleApplication3{classProgram{staticvoidMain(string[]args){}//Loadsthespecifiedmanifestresourcefromthisassembly.//fileName:createLgin.S
阅读全文
[转] 深入探索.NET框架内部了解CLR如何创建运行时对象
摘要:http://www.microsoft.com/china/MSDN/library/netFramework/netframework/JITCompiler.mspx?mfr=true发布日期: 9/19/2005 | 更新日期: 9/19/2005Hanu KommalapatiTom Christian本文讨论:•SystemDomain, SharedDomain, and DefaultDomain •对象布局和内存细节。•方法表布局。•方法分派(Method dispatching)。本文使用下列技
阅读全文
[转]“菜”鸟理解.NET Framework(CLI,CLS,CTS,CLR,FCL,BCL)
摘要:既然要学.NET,就要先认识认识她,我不喜欢大段大段文字的东西,自己通过理解,画个图,来看看.NET的沉鱼落雁,闭月羞花之容。 最下层蓝色部分是.NET Framework的基础,也是所有应用软件的基础。.NET Framework不是凭空出来的,实际上API,COM+,和一些相关驱动依然是它的基石。.NET Framework只不过是对这些前辈们进行了系统的封装和扩充,在这个过程中,吸取了Java框架的很多经验。关于Win32 API与.NET Framework API的对应关系,可以参考Microsoft Win32 to Microsoft .NET Framework API M
阅读全文
[转载]:【读书笔记】.NET本质论
摘要:【读书笔记】.NET本质论引自: http://www.cnblogs.com/yuyijq/category/187749.html【读书笔记】.NET本质论第四章-Programming with Type(Part Two) 摘要: 上一篇简单的叙说了一下不同类型内存分配的问题,以及如何在源代码上控制内存的布局,以及值类型分配的问题。本篇首先讨论对象的结构,使用Visual Studio +...
阅读全文
[转载]你必须知道的.NET
摘要:[你必须知道的.NET]目录导航引自: http://www.cnblogs.com/anytao/archive/2007/09/14/must_net_catalog.html0 开篇:开篇有益内容提要Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--...
阅读全文
BackgroundWorker实现原理
摘要:实现原理在分析BackgroundWorker实现原理之前,需要了解一下在.NET Framework 2.0版本中新增加的两个类。AsyncOperationManager 类和AsyncOperation 类都位于System.ComponentModel 命名空间中,AsyncOperation类提供了对异步操作的生存期进行跟踪的功能,包括操作进度通知和操作完成通知,并确保在正确的线程或上下...
阅读全文
浙公网安备 33010602011771号