I was just reviewing some code and noticed someone had marked member as readonly private
. Is this different from private readonly
in any way?
Example:
readonly private MyClass myInstance = new MyClass();
I have never seen this before. I always use private
then readonly
. I could not find anything on MSDN (or even in the C# spec.) that mentions what order the access modifiers can appear in. Is there an article / reference somewhere?
No, there is no difference. Another common time this happens is public static
vs static public
In either case, some people might argue it's more important to have the access modifier first, while others would argue it's more important the 'special' modifiers be seen.
But no, it doesn't make any difference at all and it's purely a style choice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With