csharp
csharp copied to clipboard
Add new reference document: readonly vs const
[C#] Add new reference document: readonly vs const
This issue describes how to add a new C# reference document: readonly vs const.
Description
The goal of the new reference document is to explain the different between (static) readonly fields versus const fields, which is confusing to many students.
The document should explain how the two approaches are different, taking into account:
- What values they can be applied to.
- Readability aspects.
- Performance characteristics.
- Memory aspects.
- Generated IL code (optional).
Based on the aforementioned differences, the document should provide guidance on when to use which approach and why.
Resources to refer to
Contributing
To create the reference, please:
- Create the document at
language/csharp/reference/readonly-vs-const.md. - Remove the corresponding TODO item in the reference README.
- Add a link to the reference document in the reference README.
I can help here! What would you like to see for instance?
@Kavignon great! Shall I assign the issue to you?
As for what is expected, this issue lists all the information we'd like to see in the document. The document itself could look like this document.
Sounds good to me!
Assign it to me!
@Kavignon Done.
@Kavignon Just checking up on your progress. Do you need any help?
Can we include readonly structs and members in this exercise.
@mikedamay This is not an exercise but a reference document. Something like https://github.com/exercism/v3/blob/master/languages/csharp/docs/code_style.md or https://github.com/exercism/v3/blob/master/languages/csharp/docs/memory_allocation.md, which are contents we can use in exercises. Originally, we considered linking to these documents, but just including their contents in the exercise might be best at first.
copied my comment to the constants exercise exercism/v3#1044.