问题描述
我使用 Environment.NewLine,我的同事使用 vbCrLf.
I use Environment.NewLine, my colleagues use vbCrLf.
当我为他们进行代码审查时,我想要一些我可以指出的东西使用 Environment.NewLine 而不是 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 更具可移植性,使使用 C# 编码的人更容易阅读代码.从技术上讲 vbCrLf 是一个常数,而 NewLine 不是.这是因为在不同的操作系统上,NewLine 可能不会返回 CR/LF.在 Unix 上它只是 LF.
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.
这篇关于vbCrLF 或 Environment.NewLine的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!