I was just writing a procedure that is looking for a newline and I was contemplating using Environment.NewLine vs ‘\n’.
Syntactically: Is Environment.NewLine clearer than ‘\n’?
And how important is portability really?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depends on how likely you are to run your program on another platform doesn’t it?
Any builtin API that abstracts platform specific semantics/syntax is always better to use, as it provides portability without much complexity overhead, but with easy gains for using it.
Writing portable C on the other-hand might be more complex and require a stronger business case for the effort. When dealing with things like C#, Python, Java and others … use the provided abstractions for those annoyances across platforms, which in many cases is what they are reduced to.