C#属性和字段
来源:互联网 发布:it编程培训学校 编辑:程序博客网 时间:2024/03/29 16:56
1.属性set时完成一些逻辑,类似方法
public const int STATE_FREE = 0;
public const int STATE_SENDCALL = 1;public const int STATE_CALLING = 2;
int _MonitorState = STATE_FREE;
// 监视状态private int MonitorState
{
set
{
switch (value)
{
case STATE_FREE:
this.btn_StartWatch.Enabled = true;
this.btn_StopWatch.Enabled = false;
break;
case STATE_SENDCALL:
case STATE_CALLING:
this.btn_StartWatch.Enabled = false;
this.btn_StopWatch.Enabled = true;
break;
}
_MonitorState = value;
}
get
{
...........
}
}
2.用new重新创建与基类同名的属性
public ManageDataService() {
this.CookieContainer = new CookieContainer();
this.Url = global::Haier.Uhome.HR91.Data.Properties.Settings.Default.Data_WebReference_DataService;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
}
else {
this.useDefaultCredentialsSetExplicitly = true;
}
}
public new CookieContainer CookieContainer
{
get
{
return base.CookieContainer;
}
set
{
base.CookieContainer = value;
}
}
public new string Url {
get {
return base.Url;
}
set {
if ((((this.IsLocalFileSystemWebService(base.Url) == true)
&& (this.useDefaultCredentialsSetExplicitly == false))
&& (this.IsLocalFileSystemWebService(value) == false))) {
base.UseDefaultCredentials = false;
}
base.Url = value;
}
}
- c# 字段和属性
- C#属性和字段
- C# 属性和字段
- c# 字段和属性
- C#属性和字段
- C# 字段和属性
- c#中的属性和字段
- C#字段和属性小结
- C#中属性和字段的区别
- C#字段和属性的区别
- C#中字段和属性的区别
- c# 字段,属性和方法总结
- C#属性和字段的认识
- C#中属性和字段的比较
- C#中字段和属性的区别
- C#中属性和字段的区别
- C#中属性和字段的区别
- C#中字段和属性的区别
- 替代资源的优先级别
- 游戏云间之一:弹性扩展
- 查看数据库死锁,并查看死锁SQL,杀死死锁进程
- 本地C++与托管C++以及Win32控制台与CLR控制台的关联
- 蓝桥杯 n进制小数
- C#属性和字段
- C#的base64编码、解码函数
- 音量图标不显示了怎么恢复
- Internet interrupt
- Sql Server 2008 在备份还原后出现数据库“受限制用户”的问题解决
- Windows中的进程的Working Set,Private Bytes和Virtual Bytes
- 要脱大家一起脱:网络实名制与官员财产透明化
- android性能优化 -- Performance Tips -- 译
- java cookie 的使用