Please give an example of when to use @@ in Razor?

I am trying to round out my understanding of all the Razor syntax, and wanted to know when to use @@?

Thanks.
newbiewebSr. Software EngineerAsked:
Who is Participating?
 
käµfm³d 👽Connect With a Mentor Commented:
The first snippet should have been in a code block! If you changed the first snippet to:

<html>
  <body>
    @@{
      Response.Write("Hello World!");
    }
  </body>
</html>

Open in new window


Then you would actually print that code out to your page--literally.
0
 
käµfm³d 👽Connect With a Mentor Commented:
I believe that's how you escape an @ so Razor doesn't pick up the symbol as a processing instruction.
0
 
newbiewebSr. Software EngineerAuthor Commented:
Oh, I see. So even though Razor can determine that:

me@gmail.com

is an email address, you could be safe and try:

me@@gmail.com

in case Microsoft accidentally overlooks all gmail email address? :)

Is that what you mean?



0
 
käµfm³d 👽Connect With a Mentor Commented:
Yes. It's a matter of:

<html>
  <body>
    @{
      Response.Write("Hello World!");
    }
  </body>
</html>

versus:

<html>
  <body>
    <a href="mailto:me@@example.com">Email Me!</a>
  </body>
</html>

Open in new window

0
 
newbiewebSr. Software EngineerAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.