c#学习笔记(曾瑛)2
2017-09-20 10:42
267 查看
1.以对象为成员/静态成员
静态变量(静态字段)静态函数(静态方法)
2.常量成员
const常量readonly常量
namespace ConsoleApplication1 { class Program { static void Main(string[] args) { } class Hotel { public readonly int roomNumber; public int guestNumber = 0; public Hotel(int roomNumberValue) { roomNumber = roomNumberValue; } private bool IsFull() { if (guestNumber >= roomNumber) return true; else return false; } public void LodgeIn() { if (IsFull()) Console.WriteLine("对不起,房间已满."); else { guestNumber++; Console.WriteLine("入住成功"); } } } } }
3.重载
运算符重载4.this关键字/数组在方法和属性中的的传递
数组在方法中的传递-索引器数组在属性中的传递
索引器
索引器访问离散字段
相关文章推荐
- (原创)c#学习笔记08--面向对象编程简介02--OOP技术06--事件
- C#开发学习笔记:利用XML配置文件连接数据库
- c# 学习笔记 显示实现接口
- C#学习笔记之七:结构和枚举
- C#索引器学习笔记
- 黑马程序员之C#编程基础学习笔记:提示用户输入密码,如果密码是“888888”,则提示正确,否则要求再输入一次,如果密码是“888888”则提示正确,否则提示错误。
- 黑马程序员之C#编程基础学习笔记:将一个字符串数组的元素的顺序进行反转。
- 【C#】通过HtmlAgilityPack+XPath来优化网页采集学习笔记
- C#学习笔记(28)——委托排序(2)自定义排序
- C#学习回顾笔记七:枚举类型的作用和使用
- 黑马程序员_c#基础知识学习笔记:习题ReadInt及冒泡排序
- C#学习笔记14——Trace、Debug和TraceSource的使用以及日志设计
- 黑马程序员_c#基础知识学习笔记:方法重载和out,ref传参
- C#回顾学习笔记十二:三元表达式
- Self-Host c#学习笔记之Application.DoEvents应用 不用IIS也能執行ASP.NET Web API
- C# 学习笔记 -- 第一天 创建第一个程序
- C# 学习笔记 -- 第四天 处理字符串
- c#学习笔记之串口通信【转】
- c#学习笔记二:构造函数执行顺序
- 【C#】菜鸟教程学习笔记(二)