我不知道这两行代码之间的区别:
public int method1 { get {return 1;} }
public int method2 {return 1}
Run Code Online (Sandbox Code Playgroud)
method1和之间有什么区别method2?我认为结果会是一样的,但是我使用第二个(method2)的原因是什么?
您似乎已尝试声明属性:
public int method1 { get {return 1;} }
Run Code Online (Sandbox Code Playgroud)
和方法:
// please, notice required ()
public int method2() {return 1;}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
62 次 |
| 最近记录: |