C # string for html storing spaces?

It seems to me that I should be missing a keyword or something in the search, because I can not find someone else looking for this ....

I have a line in C # that has line breaks, spaces, tabs, etc., and I want to display it on my html page in MVC, but keep formatting instead of losing all spaces.

At first I used some regular expression to put line breaks, but before moving on to replacing all the other possible spaces with the price range in html, it seems like a class or library will be created for this.

Does anyone know how I can easily convert a C # string to html and save a space?

Thank.

+5
source share
1 answer

just visualize it inside the tag <pre>

+7
source

All Articles