我不知道这两行代码之间的区别:
public int method1 { get {return 1;} } public int method2 {return 1}
method1和之间有什么区别method2?我认为结果会是一样的,但是我使用第二个(method2)的原因是什么?
method1
method2
c# properties
c# ×1
properties ×1