属性
来源:互联网 发布:xampp 数据库密码 编辑:程序博客网 时间:2024/04/30 00:16
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication10
{
class Program
{
private int month = 7;
public int Month
{
get
{
return month;
}
set
{
if((value>0) && (value<13)) //只有是正确的月份才可以分配新值
{
month = value;
}
}
}
static void Main(string[] args)
{
}
}
}
注:属性与方法平级,故不可放在方法内声明
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication10
{
class Program
{
private int month = 7;
public int Month
{
get
{
return month;
}
set
{
if((value>0) && (value<13)) //只有是正确的月份才可以分配新值
{
month = value;
}
}
}
static void Main(string[] args)
{
}
}
}
注:属性与方法平级,故不可放在方法内声明
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- 属性
- Linux高可用性方案之Heartbeat的watchdog配置(转)
- UVa 106 && POJ 1305 - Fermat vs. Pythagoras(毕达哥拉斯三元组)
- 1.4JSP指令元素
- 自己使用DEBUG宏经历
- android的文件操作
- 属性
- 弹窗输入内容,返回内容 不使用屏幕
- 解决360\小红伞杀毒报网页HTML.Rce.Gen3恶意程序的问题
- Mysql 5.1 开启慢查询日志功能
- 利用Calendar获取Date中的年、月、日、时、分、秒等
- 操作系统内存管理机制
- Java上路02-Hello World
- Freemarker的模板
- 关于PHP的配置问题