I use Environment.NewLine, my colleagues use vbCrLf.
When I'm doing a code review for them I want something that I can point to to say "use Environment.NewLine instead of vbCrLf"
Or, am I just peeing in the wind, and it doesn't really matter ?
Environment.NewLine is more portable, making to code easier to be read by someone coding in C#. Technically vbCrLf is a constant, where NewLine is not. This is because on a different OS, NewLine may not return CR/LF. On Unix it would just be LF.
Another point is that Environment.NewLine
expresses the intended meaning more clearly. In most cases, the goal is Place a newline in this string, not Place carriage-return and line-feed characters in this string. Environment.NewLine
states what to do, vbCrlf
states how to do it.
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