[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

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.
0
newbieweb
Asked:
newbieweb
  • 3
  • 2
3 Solutions
 
käµfm³d 👽Commented:
I believe that's how you escape an @ so Razor doesn't pick up the symbol as a processing instruction.
0
 
newbiewebAuthor 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 👽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
 
käµfm³d 👽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
 
newbiewebAuthor Commented:
Thanks!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now