原创 C#獲取文件夾下的子文件夾
public static List <string> getDirectory(string path) { List<String> list = new List<string>();
原创 C#測程序運行時間
System.Diagnostics.Stopwatch Runtime = new System.Diagnostics.Stopwatch(); public Form1() {
原创 C# 獲取系統時間及時間格式
--DateTime 數字型 System.DateTime currentTime=new System.DateTime(); 取當前年月日時分秒 currentTime=System.DateTime.Now; 取當
原创 C#跳出循環break,continue,go to,return的關鍵字
break是循環結束執行,執行循環體後面的代碼。 continue是跳過本次循環未執行的代碼,繼續執行下一次循環。 goto是跳到指定的指令去,你指哪,他跳到哪。 test1://標籤1 for (int i =
原创 C#只保留字符串數字和漢字(不包括拼音打出來的)
public static List<string> CharacterRemoval() { for (int i = 0; i < nickNameList.Count; i++)
原创 C#寫入或生成新的TXT文件中
public void CreatTxt() { string str=" "; if (!File.Exists("C:\\Users\\Administrator\\De
原创 C#獲得windows任務欄窗口句柄及一些操作(放大、縮小、關閉、隱藏……)
需調用API函數 需在開頭引入命名空間using System.Runtime.InteropServices; 1、通過窗口名字查找 [DllImport("user32.dll", EntryPoint = "FindWindow")