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]; //用循环直接赋值
foreach (string s in str){ Console.Write(s);}
string[,] arr2; //声明一个二维数组string[,,] arr3; //声明一个多维数组
每一行长度不一样的数组。
使用new修饰符可以隐藏继承自基类的接口
public class Class2:Class1{ new public interface Iinterface { void PRint(); }}
继承多个接口:
public interface Iinterface3 : Iinterface1, Iinterface2, Iinterface3{ void Print3();}
接口的属性方法等不能具体实现,只能声明。如:
public interface Iinterface{ string Name { get; set; }}
public class Program : Iinterface
抽象类的特点:不能被密封,不能直接实例化,允许包含抽象成员
新闻热点
疑难解答