---
title: "How we do comments in Asp.Net MVC Razor View?"  
description: "How we do comments in Asp.Net MVC Razor View?"  
author: "Anonymous User"  
published: 2020-02-05  
updated: 2020-02-05  
canonical: https://www.mindstick.com/forum/155787/how-we-do-comments-in-asp-dot-net-mvc-razor-view  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 2 minutes  

---

# How we do comments in Asp.Net MVC Razor View?

[Please tell me](https://www.mindstick.com/forum/33900/please-tell-me-what-are-the-technique-to-content-optimization) hoe we do comment in [asp.net MVC](https://www.mindstick.com/forum/155798/what-is-caching-in-asp-dot-net-mvc) with a suitable example.

## Replies

### Reply by Nishi Tiwari

To do commenting in Razor view is a little different than C# comments. In C# we use **(“//")** for commenting but in Razor, we will define comments like this **("@* *@").**

## The syntax for Commenting in Razor View

Syntax of comments in [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) razor view will be shown like below

```
 
@* It is a Razor multiline comment *@ 
```

These razor view syntax (“ @* *@") tells that which code inside this will be ignored from being executed. **[The syntax is common for both vb.net and C# language using Razor.](https://www.mindstick.com/forum/155786/what-is-html-helper-in-asp-dot-net-mvc-razor-view)**

## Shortcut to Comment Block

The shortcut for Razor Commenting is similar to C# shortcut which would be shown

- For Comment the block use ( Ctrl E, C)
- For Uncomment the block use ( Ctrl E, U)

The examples will show how to use razor comments in asp.net [MVC](https://www.mindstick.com/forum/155803/define-cache-profile-in-mvc) applications

## Example1

The example shows how to use comments in MVC razor view

```
<table>
<tr>
<td>DisplayName</td>
@*<td>@Html.DisplayName("Displayname")</td>*@
</tr>
</table>
```

## Example2

This is another example to use comments in MVC razor view

![How we do comments in Asp.Net MVC Razor View?](https://www.mindstick.com/mindstickforums/69bda5a6-95cb-44d3-ba99-3c7e6c1c091a/images/e35f9793-6eb3-4e68-b71e-133b5f9adb8d.png)\

This way we can use comments in razor view applications in asp.net MVC.


---

Original Source: https://www.mindstick.com/forum/155787/how-we-do-comments-in-asp-dot-net-mvc-razor-view

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
