
类和对象
������.cs������������������������������ ��������������������������� C#���������������������������GC��������������������������������������������������������������������� ������������������������������������ camelCase ��������������� ������������������������
发布日期:2021-05-14 14:40:21
浏览次数:17
分类:精选文章
本文共 2354 字,大约阅读时间需要 7 分钟。
C#������������������������������
1. ������������
���C#������������class
���������������������������������
class Student{ public int stu_id; public string stu_name; public bool stu_sex; public string stu_phone;}
���������������
internal
������������������������public
2. ���������������
������������������������������������������������������������������������.()
���
������������������
class Example{ public int number = 66; // ������ public void Output() { Console.WriteLine("number: " + number); // ������ }}
���������������
class Program{ static void Main(string[] args) { Example ex = new Example(); ex.number += 3; ex.Output(); }}
3. ������������
������������������������������������������������������������������������������������
���������
class Student{ public int stu_id; public string stu_name; public bool stu_sex; public string stu_phone; public Student() { // ��������������������������� } public Student(int stu_id) { this.stu_id = stu_id; } public Student(int stu_id, string name) { this.stu_id = stu_id; this.stu_name = name; }}
���������������
class Program{ static void Main(string[] args) { Student s1 = new Student(); Student s2 = new Student(314521); Student s3 = new Student(1314521, "major_s"); }}
4. ���������������Partial Classes���
C#���������������������������������������������������������partial
������������
���������
public partial class MyForm{ public void ButtonClicked() { Console.WriteLine("Button '{0}' is clicked", this.button); }}
public partial class MyForm{ public String button = "������"; public void UserPressButton() { this.ButtonClicked(); }}
���������������
class Program{ static void Main(string[] args) { MyForm form = new MyForm(); form.button = "������"; form.UserPressButton(); }}
������������
string
������������������null
���������������������������������������发表评论
最新留言
感谢大佬
[***.8.128.20]2025年04月06日 07时14分07秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
python中的序列化
2021-05-15
django中使用celery执行异步任务实现
2021-05-15
centos7 安装 mongodb3.6.3
2021-05-15
java有道翻译
2021-05-15
lora技术在无线抄表行业应用
2021-05-15
msfvenom的使用&免杀&外网渗透
2021-05-15
HTTP/2 协议详解
2021-05-15
grafana改用https登录
2021-05-15
使用MySQLTuner-perl对MySQL进行优化
2021-05-15
2018年3月最新的Ubuntu 16.04.4漏洞提权代码
2021-05-15
异或交换两个数的值
2021-05-15
使用python绘出常见函数
2021-05-15
Golang AES加密
2021-05-15
Puppet的一些奇技淫巧
2021-05-15
foreman源NO_PUBKEY 6F8600B9563278F6
2021-05-15
亚马逊aws文档语法错误
2021-05-15
什么是5G?居然有人用漫画把它讲得如此接地气!
2021-05-15
Spring cloud --分布式配置中心组件Spring Cloud Config
2021-05-15
UE4接入Android第三方库2——通过JIN与GameActivity通信
2021-05-15
Unity Job System 2——并行处理数据
2021-05-15