Fields
1. Field is a variable of a class
2. If it’s readonly field, can only assign its value in declaration or constructor
Properties
1. Define a get and/or set accessor
2. Two usual implement types of property, automatical and full
3. In Visual Studio, code snippet are prop (for automatical) and propfull (for full)
Field & Property
1. A field needs memory to store data, but a property doesn’t
2. Different icons
沒有留言:
張貼留言