A field is a variable that is a member of a class or struct. For example:
class Person { string name; public int Age = 10; }
Fields allow the following modifiers:
Item | Value |
---|---|
Static modifier | static |
Access modifiers | public internal private protected |
Inheritance modifier | new |
Unsafe code modifier | unsafe |
Read-only modifier | readonly |
Threading modifier | volatile |