summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorksami <ksami.ihide@gmail.com>2017-10-23 17:36:18 +0800
committerGitHub <noreply@github.com>2017-10-23 17:36:18 +0800
commitb01b53a46dbb4d2a35c44ad2caff521f442b2741 (patch)
tree2cdd418e1fa539140706c9ee846e5ff2e3c0afe4
parent7c2bd365bd4f69d9d48b06fd1f2628dafc5218fb (diff)
clarify use case for verbatim strings
added example for using @ symbol with strings
-rw-r--r--csharp.html.markdown6
1 files changed, 6 insertions, 0 deletions
diff --git a/csharp.html.markdown b/csharp.html.markdown
index 963f38f4..bb8bf6e5 100644
--- a/csharp.html.markdown
+++ b/csharp.html.markdown
@@ -132,6 +132,12 @@ namespace Learning.CSharp
DateTime fooDate = DateTime.Now;
Console.WriteLine(fooDate.ToString("hh:mm, dd MMM yyyy"));
+ // Verbatim String
+ // You can use the @ symbol before a string literal to escape all characters in the string
+ string path = "C:\\Users\\User\\Desktop";
+ string verbatimPath = "C:\Users\User\Desktop";
+ Console.WriteLine(path == verbatimPath); // => true
+
// You can split a string over two lines with the @ symbol. To escape " use ""
string bazString = @"Here's some stuff
on a new line! ""Wow!"", the masses cried";