VB:
目前分類:C# (87)
- Dec 27 Mon 2010 23:53
C# VB的ReDim Preserve轉成C# record
- Dec 22 Wed 2010 14:10
C# GUID產生亂數字串 record
除了一般的Random方式以外
- Dec 21 Tue 2010 12:00
C# 字串變數, 如何包含雙引號或反斜線 record
C# 字串變數, 如何包含雙引號或反斜線
- Dec 21 Tue 2010 09:52
C# 字串搜尋 record
class TestRegularExpressions { static void Main() { string[] sentences = { "cow over the moon", "Betsy the Cow", "cowering in the corner", "no match here" }; string sPattern = "cow"; foreach (string s in sentences) { System.Console.Write("{0,24}", s); if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase)) { System.Console.WriteLine(" (match for '{0}' found)", sPattern); } else { System.Console.WriteLine(); } } } }
輸出
cow over the moon (match for 'cow' found) Betsy the Cow (match for 'cow' found) cowering in the corner (match for 'cow' found) no match here
- Dec 20 Mon 2010 10:14
C# 事件宣告與實作(不用委派) record
- Dec 18 Sat 2010 13:47
C# 開啟網頁 record
System.Diagnostics.Process.Start("http://tw.yahoo.com/?hpp=r1b");
- Dec 17 Fri 2010 12:12
C# 判斷字串裡面是否有數字 record
判斷字串裡面是否有數字
static bool isnumeric(string str)
- Dec 14 Tue 2010 12:18
C# 十進制轉各進制,再轉回來 record
//十進制轉二進制
Console.WriteLine(Convert.ToString(69, 2));
- Dec 13 Mon 2010 15:42
C# 判斷是否有多開程式 record
Process thisProc = Process.GetCurrentProcess();
- Dec 07 Tue 2010 11:53
C# StringBuilder 比 String 較有效率 record
我們必須開門見山地說,在相同字串的許多操作上,使用 StringBuilder 類別會比使用一個 String 物件來得更有效率。
大家務必瞭解,System.String 資料型別(或是說 String 物件)代表的是一種不變的字串,也就是說,一旦您設定其值,您就不能更改它。如果您嚐試要插入、刪除或更改字串的任何部分,唯一的方式就是去建立一個新的字串。說得更專業點,每次字串資料變更時,記憶體中該字串原來的表示法就會被破壞掉,並建立內含新字串資料的新表示法,此舉會引發對記憶體的配置作業以及對記憶體的反配置作業。當然,這些作業都是在幕後完成的,因此真正的成本並不會立刻顯現。配置與反配置記憶體會加重 Common Language Runtime(CLR)裡記憶體管理和記憶體回收的相關工作,所以絕對是要付出代價的,直接的影響,就是增了處理時間。這種情況在迅速地接連配置和反配置佔有大塊記憶體的字串時尤其明顯,就像在大量字串串連時所發生的情況一樣。雖然這種情形在單一使用者環境裡不會帶來任何問題,但是在伺服器的環境裡使用時(比方說,在 Web 伺服器上執行的 ASP.NET® 應用程式中),卻可能在效能與延展性上造成極為嚴重的問題。
- Dec 07 Tue 2010 11:17
C# VB.net 的 ParamArray 轉成 C# 用法 record
- Dec 06 Mon 2010 11:11
C# 字串轉byte byte再轉字串 record
- Nov 17 Wed 2010 12:30
C# 時間間隔 計算 record
- Nov 17 Wed 2010 10:15
C# TcpClient record
- Nov 05 Fri 2010 16:35
C# 取得版本 record
string[] 版號 = Application.ProductVersion.Split('.');
string 版本 = 版號[0] + "." + 版號[1] + "." + 版號[2];
- Nov 03 Wed 2010 14:40
C# Key record
You have a TextBox control on your Windows Forms application and need to detect Enter. The TextBox allows your users to type letters into it, and you need to detect when a certain key is pressed. Our solution involves the KeyDown event in our C# Windows Form. We use the KeyDown event for our code.
Using KeyDown event
Open designer and click on TextBox. In the Visual Studio 2008 designer, click on your TextBox control in the form display. You will see the Properties Pane. Next, click on the lightning bolt icon. This icon stands for events. In the event tab, scroll to KeyDown, and double click in the space to the right. New code like that highlighted below will appear.
- Nov 03 Wed 2010 13:45
C# ToString 格式 record
C#:
前面補0的數字字串
- Nov 01 Mon 2010 17:28
C# Dictionary用法 record
Dictionary<string, object> tagDictionary = new Dictionary<string, object>();
- Oct 28 Thu 2010 23:23
C# 搜尋目錄 record
//=========================================================================================
不取得子目錄的話用這個: