夜光序言:
人生不易,不要笑话别人。
家家都有难念的经,人人都有难唱的曲。
再风光的人,背后也有寒凉苦楚;
再幸福的人,内心也有无奈难处。
谁的人生都不易,笑人等于笑己,尊重别人就是尊重自己。
最穷无非讨饭,不死总会出头。
谁的人生十全十美,谁的生活没有薄凉,谁敢保证一直都人生得意。
金无足赤,人无完人。
正文:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 案例1
{
class Program
{
//值类型和引用类型~
//struct 结构体,表示自定义的值类型
struct Stu
{
// 如果我们想要访问这些参数,那么需要加上public
public int no;
public int age;
public int chinese;
public int math;
public int english;
//我们重写一下tostring方法
public override string ToString()
{
return string.Format("no={0},age={1},chinese={2},math={3},english={4}"
,no,age,chinese,math,english);
}
}
static void Main(string[] args)
{
//夜光:我们先new出来下面这四个对象
Stu s1 = new Stu() { no = 1, age = 11, chinese = 111, math = 1111, english = 11111 };
Stu s2 = new Stu() { no = 2, age = 11, chinese = 111, math = 1111, english = 11111 };
Stu s3 = new Stu() { no = 3, age = 11, chinese = 111, math = 1111, english = 11111 };
Stu s4 = new Stu() { no = 4, age = 11, chinese = 111, math = 1111, english = 11111 };
Console.WriteLine(sizeof(int));
Console.ReadLine();
}
}
}