C#
C# [**] static 方法 只能存取外部的static 變數 //Example.cs namespace TetrisServer { class Program { static private string ip; private int port; static void Main(string[] args) { ip = "XXX"; //OK port = 57; // fail } } } 字串處理 1. string str = "asdaa asd qwe"; string str1 = str.Substring(0,str.IndexOf(" ")); //=> "asdaa" string str2 = str.Substring(str.IndexOf(" ")+1); //=> "asd" 2. string str = "asdqwe asd sad"; string[] strr = str.Split(new char[] { ' ' }); //=> strr = "asdqwe","asd","sad" ----------------------------------------------------------------------------------------------------------------------- string 加入換行 string str = str + System.Environment.NewLine; --------------------------------------------------------------------------------------------------------