以public String MyProperty { get; set; }这种格式生成idOPERATIONS, GDNAME, GZNAME, NEWTIME, vnuitpl, SGTIME, SGR对应格式方法
时间: 2024-05-16 12:12:46 浏览: 79
php面向对象全攻略 (六)__set() __get() __isset() __unset()的用法
这种格式是C#语言中的属性声明格式,对应的方法是Getter和Setter方法,可以使用以下代码生成idOPERATIONS, GDNAME, GZNAME, NEWTIME, vnuitpl, SGTIME, SGR对应的Getter和Setter方法:
```
public class MyClass
{
private string _idOPERATIONS;
private string _GDNAME;
private string _GZNAME;
private string _NEWTIME;
private string _vnuitpl;
private string _SGTIME;
private string _SGR;
public string idOPERATIONS
{
get { return _idOPERATIONS; }
set { _idOPERATIONS = value; }
}
public string GDNAME
{
get { return _GDNAME; }
set { _GDNAME = value; }
}
public string GZNAME
{
get { return _GZNAME; }
set { _GZNAME = value; }
}
public string NEWTIME
{
get { return _NEWTIME; }
set { _NEWTIME = value; }
}
public string vnuitpl
{
get { return _vnuitpl; }
set { _vnuitpl = value; }
}
public string SGTIME
{
get { return _SGTIME; }
set { _SGTIME = value; }
}
public string SGR
{
get { return _SGR; }
set { _SGR = value; }
}
}
```
注意,属性的Getter和Setter方法都需要与属性的访问修饰符相同,本例中使用了public修饰符。
阅读全文