csharp icon indicating copy to clipboard operation
csharp copied to clipboard

Add new reference document: readonly vs const

Open ErikSchierboom opened this issue 5 years ago • 9 comments
trafficstars

[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:

ErikSchierboom avatar Jan 14 '20 15:01 ErikSchierboom

I can help here! What would you like to see for instance?

Kavignon avatar Feb 06 '20 09:02 Kavignon

@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.

ErikSchierboom avatar Feb 06 '20 11:02 ErikSchierboom

Sounds good to me!

Kavignon avatar Feb 06 '20 12:02 Kavignon

Assign it to me!

Kavignon avatar Feb 11 '20 18:02 Kavignon

@Kavignon Done.

ErikSchierboom avatar Feb 12 '20 06:02 ErikSchierboom

@Kavignon Just checking up on your progress. Do you need any help?

ErikSchierboom avatar Apr 08 '20 12:04 ErikSchierboom

Can we include readonly structs and members in this exercise.

mikedamay avatar Jul 07 '20 06:07 mikedamay

@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.

ErikSchierboom avatar Jul 07 '20 07:07 ErikSchierboom

copied my comment to the constants exercise exercism/v3#1044.

mikedamay avatar Jul 09 '20 08:07 mikedamay