Skip to content

Commit 7f46afe

Browse files
Mention properties are rare in Rust, as opposed to in C#
1 parent 22fdebd commit 7f46afe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/language/custom-types/members.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ impl Rectangle {
162162
}
163163
```
164164

165+
> Note: While in C# it is idiomatic to expose a property for every field and keep
166+
> the fields private, in Rust it is more common to expose the fields directly when possible,
167+
> since there is no syntax sugar for accessor methods and they also have complexities
168+
> with the borrow checker.
169+
165170
## Extension Methods
166171

167172
Extension methods in C# enable the developer to attach new statically-bound

0 commit comments

Comments
 (0)