Regex(regular expressions)是一套文法匹配規則,各種語言,如perl, .Net和Java都有其對應的共用的Regex類庫。在.Net中,這個類庫叫做regex。簡單的說,regex是從字元窗中尋找匹配字串的應用類。通過regex,編程人員能夠非常方便的從一段資料中提取自己所需要的資料資訊。舉一個簡單的例子,讓大家對regex有個大概的瞭解:regex regex = new regex(@"d+"); match m = regex.match("fox
using System;using System.Net;using System.Threading;using System.Text;using System.IO; namespace asynch{#region 簡單非同步 class Program { //聲明委託 public delegate void AsyncEventHandler(); //非同步方法呼叫 void Event1()
C#3.0後語言特性:自動屬性(Automatic Properties)如果你現在是C#開發人員的話,你大概非常習慣編寫象下面這個程式碼片段一樣帶有基本屬性的類型: public class Person { private string _firstName; private string _lastName; private int _age; public string FirstName {
最近在學習C# 2.0,在.NET Framework 2.0中新增加了System.Nullable泛型結構,它具有處理實值型別資料具和處理null的功能。例如:System.Nullable<int> i = 2; i = null; System.Nullable<bool> b = null; 另外C#中還提供了上述表示方法的簡寫形式:int? i = null; bool? b = null;
文章目錄 Dynamically Typed ObjectNamed and optional parametersImproved COM InteroperabilityCo- and Contra-VarianceCompiler as a Service 原文終於靜下心來仔細聽了一遍Anders Hejlsberg(Visual Studio組的TECHNICAL FELLOW,C#的設計者之一)在PDC08上講的“The
前兩天做了一個自訂單件Timer,該Timer能夠根據相應資料記錄(Row)中的記錄ID和設定分鐘Minutes 做相應的事件調用,但是如果此事件處理常式在一Form中時則不能正確調用它,但是把82到93行的注釋去掉就可以了。 Timer大體定義如下: 1 using System; 2 using System.Threading; 3 using System.ComponentModel; 4 using System.Windows.Forms; 5 6 /*****