Do you format "Environment.NewLine" at the end of a line?

Updated by Brady Stroud [SSW] 1 year ago. See history

123

<introEmbed
  body={<>
You should format "Environment.NewLine" at the end of a line.
  </>}
/>
```csharp
string message = "The database is not valid." + Environment.NewLine + "Do you want to upgrade it? ";
```

<figureEmbed figureEmbed={{
  preset: "badExample",
  figure: 'Bad example - "Environment.NewLine" isn\'t at the end of the line',
  shouldDisplay: true
} } />


```csharp
string message = "The database is not valid." + Environment.NewLine;
message += "Do you want to upgrade it? ";
```

<figureEmbed figureEmbed={{
  preset: "goodExample",
  figure: 'Good example -  "Environment.NewLine" is at the end of the line',
  shouldDisplay: true
} } />


```csharp
return string.Join(Environment.NewLine, paragraphs);
```

<figureEmbed figureEmbed={{
  preset: "goodExample",
  figure: 'Good example - "Environment.NewLine" is an exception for String.Join\',
  shouldDisplay: true
} } />

Acknowledgements

Adam Cogan
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star