I have MVC website, and I would like to show some code snippets as text on my website. Something like this:
List<ImageInfoModel> imgList = new List<ImageInfoModel>();
string imgPath = @"~/Content/Images/ImageGallery/";
string tmbPath = @"~/Content/Images/ImageGallery/thumbnails/";
string imgFullPath = Server.MapPath(imgPath);
string tmbFullPath = Server.MapPath(tmbPath);
If I simply copy and paste this into my view with
code text
it messes things up because of @ symbol.
So my question is: How can I display C# code inside my view?
Thanks in advance.
@Html.Rawas a starting point.