Time of Update: 2018-12-07
Effective C# 原則35:選擇重寫函數而不是使用事件控制代碼Item 35: Prefer Overrides to Event
Time of Update: 2018-12-07
使用反射動態調用類成員,需要Type類的一個方法:InvokeMember。對該方法的聲明如下(摘抄於MSDN):public object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args);參數name String,它包含要調用的建構函式、方法、屬性或欄位成員的名稱。 - 或 - Null 字元串 (""),表示調用預設成員。
Time of Update: 2018-12-07
Effective C# 原則42:使用特性進行簡單的反射Item 42: Utilize Attributes to Simplify
Time of Update: 2018-12-07
Effective C# 原則27:避免使用ICloneableItem 27: Avoid ICloneable ICloneable看上去是個不錯的主意:為一個類型實現ICloneable介面後就可以支援拷貝了。如果你不想支援拷貝,就不要實現它。但你的對象並不是在一個“真空”的環境中運行,但考慮到對衍生類別的些影響,最好還是對ICloneable支援。一但某個類型支援ICloneable,
Time of Update: 2018-12-07
Effective C# 原則24:選擇申明式編程而不是命令式編程Item 24: Prefer Declarative to Imperative Programming
Time of Update: 2018-12-07
http://www.2ed.cn/Article-150-21922.shtml不同於一般形式的軟體編程,嵌入式系統編程建立在特定的硬體平台上,勢必要求其程式設計語言具備較強的硬體直接操作能力。無疑,組合語言具備這樣的特質。但是,歸因於組合語言開發過程的複雜性,它並不是嵌入式系統開發的一般選擇。而與之相比,C語言--一種"進階的低級"語言,則成為嵌入式系統開發的最佳選擇。筆者在嵌入式系統項目的開發過程中,一次又一次感受到C語言的精妙,沉醉於C語言給嵌入式開發帶來的便利。 圖1給出了本文的討論
Time of Update: 2018-12-07
Effective C# 原則23:避免返回內部類對象的引用Item 23: Avoid Returning References to Internal Class Objects你已經知道,所謂的唯讀屬性就是指調用者無法修改這個屬性。不幸運的是,這並不是一直有效。如果你建立了一個屬性,它返回一個參考型別,那麼調用者就可以訪問這個對象的公用成員,也包括修改這些屬性的狀態。例如:public class MyBusinessObject{ // Read Only property
Time of Update: 2018-12-07
Effective C# 原則50:瞭解ECMA標準Item 50: Learn About the ECMA StandardECMA標準是C#語言所有功能的官方說明。ECMA-334定義了C#語言1.0的標準,你可以從The C# Programming Language這本書上學習C#2.0的計劃(譯註:現在已經不是計划了),這本書的作者是Anders Hejlsberg, Scott Wiltamuth, 和 Peter Golde (Addison-Wesley,
Time of Update: 2018-12-07
http://blog.chinaunix.net/u/22520/showart_308803.html經典的C語言著作,“C語言四書五經”一、The C Programming Language C程式設計語言(第2版·新版) 原出版社: Prentice Hall PTR 作者: [美]Brian W.Kernighan,Dennis M.Ritchie譯者: 徐寶文 李志書號: 7-111-12806-0 頁碼: 258 開本: 16開 版次:2-1 叢書名: 電腦科學叢書 出版社: 機
Time of Update: 2018-12-07
Effective C# 原則39:使用.Net驗證Item 39: Use .NET
Time of Update: 2018-12-07
轉自http://5543541.qzone.qq.com/blog/23Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-07
英文原版地址:http://www.sellsbrothers.com/writing/default.aspx?content=delegates.htm .NET委託:一個C#睡前故事 英文版原作者:Chris Sells(www.sellsbrothers.com)翻譯:袁曉輝(www.farproc.com
Time of Update: 2018-12-07
轉自msdn 的。。Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-07
Wtypes.h 中的非託管類型 非託管C 語言類型 託管類名 說明HANDLE void* System.IntPtr 32 位BYTE unsigned char System.Byte 8 位SHORT short System.Int16 16 位WORD
Time of Update: 2018-12-07
最近做中興的程式設計競賽中一道題,需要用到資料存放區功能。每隔一段時間會收到一組資料,依次把這一組資料存放區到檔案中,但是需要設定一個值,該值表示能夠儲存的最大條數。如果達到這個條數之後,就像前覆蓋一條記錄,把新的存進去。這個值是中途可以更改的。 於是思路就成了,刪除第一條記錄,再在檔案末尾增加新的記錄。 首先聲明一個list<int>儲存每條記錄的長度。Code highlighting produced by Actipro
Time of Update: 2018-12-07
C語言中,前置處理器功能:1. #include <>or" " 的標頭檔替換2.#define <identifier> <replacement token list> 對象替換(object-like) 對象替換以第一個空格為分割,之後的為replacement token list3.#define <identifier>(<parameter list>) <replacement token
Time of Update: 2018-12-07
文章系參考轉載,英文原文網址請參考:http://www.albahari.com/threading/ 作者 Joseph Albahari, 翻譯 Swanky Wu 中文翻譯作者把原文放在了"google 協作"上面,GFW屏蔽,不能訪問和查看,因此我根據譯文和英文原版整理轉載到園子裡面。 本系列文章可以算是一本很出色的C#線程手冊,思路清晰,要點都有介紹,看了後對C#的線程及同步等有了更深入的理解。入門 概述與概念 建立和開始使用多線程 線程同步基礎同步要領 鎖和安全執行緒
Time of Update: 2018-12-07
在使用WinForm標準的TreeView控制項的過程中,添加了如下類似的節點parentNode1 ---childNode1 ---childNode2parentNode2 ---childNode1 ---childNode2
Time of Update: 2018-12-07
using System;using System.Runtime.InteropServices;using System.Drawing;using System.Drawing.Imaging;namespace Video{/// <summary>/// 一個控制網路攝影機的類/// </summary>public class VideoWork{private const int WM_USER = 0x400;private const int
Time of Update: 2018-12-07
1.要實現鎖定系統不讓別人用,可以調用系統鎖定API函數來實現//引入API函數 [DllImport("user32 ")] public static extern bool LockWorkStation();//這個是調用windows的系統鎖定在需要的時候直接寫LockWorkStation();就可以啦!不信試試看!2.API函數鎖定鍵盤及滑鼠[DllImport("user32.dll")] static extern void