第一次運行時:第二次運行時:複製代碼 代碼如下: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace 檔案操作 { class Program { static void Main(string[] args) { //建立一個文字檔,最好先判斷一下 StreamWriter sw; if
複製代碼 代碼如下: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Drawing; using System.Drawing.Drawing2D; using System.IO; using System.Drawing.Imaging; using System.Collections; namespace Curve { public
複製代碼 代碼如下: class A { public virtual void Func() // 注意virtual,表明這是一個虛擬函數 { Console.WriteLine("Func In A"); } } class B : A // 注意B是從A類繼承,所以A是父類,B是子類 { public override void Func() // 注意override ,表明重新實現了虛函數 { Console.WriteLine("Func In B"); } } class C :
Escape: 複製代碼 代碼如下: public static string Escape(string str) { StringBuilder sb = new StringBuilder(); foreach (char c in str) { sb.Append((Char.IsLetterOrDigit(c) || c == '-' || c == '_' || c == '\\' || c == '/' || c == '.') ? c.ToString() :
首先, 調用系統 API, 這裡如果要引用神馬的, 就不一一列出了, 大家自己引用一下. 複製代碼 代碼如下: [StructLayout(LayoutKind.Sequential)] public struct MARGINS { public int Left; public int Right; public int Top; public int Bottom; } [DllImport("dwmapi.dll", PreserveSig = false)] public