複製代碼 代碼如下:using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Diagnostics; using System.Threading; namespace WindowsApplication2 { /// <summary>
(1)用於對靜態欄位、唯讀欄位等的初始化。 (2)添加static關鍵字,不能添加存取修飾詞,因為靜態建構函式都是私人的。 (3)類的靜態建構函式在給定應用程式定義域中至多執行一次:只有建立類的執行個體或者引用類的任何靜態成員才激發靜態建構函式 (4)靜態建構函式是不可繼承的,而且不能被直接調用。 (5)如果類中包含用來開始執行的 Main 方法,則該類的靜態建構函式將在調用 Main
可以用DSA和RSA,如: using System; using System.Text; using System.Security.Cryptography; class dsacrypto_SignData { public static void Main(String[] args){ //先要將字串轉換為位元組數組,這與編碼有關。 String str = "this is a test."; byte[] bytes = Encoding.ASCII.GetBytes(str);
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Net; using System.Threading; namespace WindowLanSearch { /// <summary> /// Form1 的摘要說明。 /// &
作者:Sabine 【導讀】本文介紹了C#的四種排序演算法:冒泡排序、選擇排序、插入排序和希爾排序 冒泡排序 using System; namespace BubbleSorter { public class BubbleSorter { public void Sort(int [] list) { int i,j,temp; bool done=false; j=1; while((j<list.Length)&&(!done)) {
using System; using System.Runtime.InteropServices; using System.Management; namespace Hardware { /// <summary> /// Hardware_Mac 的摘要說明。 /// </summary> public class HardwareInfo { //取機器名 public string GetHostName() { return
using System; using System.DirectoryServices; using System.Collections; using System.Text.RegularExpressions; using System.Text; /** * @author 吳海燕 * @email wuhy80-usual@yahoo.com * 2004-6-25 第一版 */ namespace Wuhy.ToolBox { ///