资源说明:public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void button_Click(object sender, RoutedEventArgs e)
{
//类对象的实例化
//MyClass mc = new MyClass();
////类型转换
//Interface1 i1 = (Interface1)mc;
//this.textBlock.Text=i1.Add(3, 5).ToString();
//Interface2 i2 = (Interface2)mc;
//this.textBlock.Text += " "+i2.Add(3, 5).ToString();
//Student st = new Student();
//st.sno = "0101001";
//st.name = "Tom";
//st.age = 18;
//
var st1 = new Student { sno = "0101001", name = "Tom", age = 18 };
//this.textBlock.Text = st.sno + "--" + st.name + "--" + st.age;
var p = new { sno = "0101002", name = "Jack", age = 20 };
// this.textBlock.Text +="\n" + p.sno + "--" + p.name + "--" + p.age;
List list = new List();
list.Add("a");
list.Add("b");
//
List list2 = new List { "a", "b" };
List list3 = new List();
Student st = new Student();
st.sno = "0101001";
st.name = "Tom";
st.age = 18;
list3.Add(st);
Student st2 = new Student();
st2.sno = "0101001";
st2.name = "Tom";
st2.age = 18;
list3.Add(st2);
//
List list1 = new List
{
new Student {sno = "0101001", name = "Tom", age = 18 },
new Student { sno = "0101002", name = "Jack", age = 20 }
};
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。
English
