string[] s1 = {“aaa”,”bbb”,”ccc”} //直接賦值string[] s2 = new string[3] {“aaa”,”bbb”,”ccc”}; //賦值加指定長度string[] s3 = new string[]{“aaa”,”bbb”,”ccc”}; string[] s4 = new string[5]; //用循環(huán)直接賦值foreach (string s in str){ Console.Write(s);}string[,] arr2; //聲明一個(gè)二維數(shù)組string[,,] arr3; //聲明一個(gè)多維數(shù)組
每一行長度不一樣的數(shù)組。
使用new修飾符可以隱藏繼承自基類的接口
public class Class2:Class1{ new public interface Iinterface { void PRint(); }}繼承多個(gè)接口:
public interface Iinterface3 : Iinterface1, Iinterface2, Iinterface3{ void Print3();}接口的屬性方法等不能具體實(shí)現(xiàn),只能聲明。如:
public interface Iinterface{ string Name { get; set; }}public class Program : Iinterface
抽象類的特點(diǎn):不能被密封,不能直接實(shí)例化,允許包含抽象成員
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注