- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 191字
- 2021-07-02 15:29:22
Making a verbatim string
In the preceding line, you need to specify the key-value pairs within the parentheses. The key is notepad.exe. If you try to put a path such as c:\data\samplefile.txt directly into your code, it doesn't work. You see how it gets underlined red? The popup says Represents text as a series of Unicode characters. These things don't work. So, to fix this, you put the @ (at) symbol in front of it. Now, you have a verbatim string.
With the old approach, this is how you handled this: c:\\data\\samplefile.txt. This is called character escaping. If you try this with the preceding line, notice that the red underline goes away because c:\ already means something. So, to escape the usual meaning, you add the second backslash. This is the old way, though. The new way for this situation is to use a verbatim, string so that it's interpreted exactly as it appears.
In this context here, Notepad is the key and the value is the samplefile.txt file.
Next, enter the following line directly beneath the preceding one:
filePrograms.Add("iexplore.exe", "http://www.bing.com");
So, Internet Explorer will open the http://www.bing.com page. You see?
推薦閱讀
- 流量的秘密:Google Analytics網(wǎng)站分析與優(yōu)化技巧(第2版)
- JavaScript 從入門到項(xiàng)目實(shí)踐(超值版)
- Android Jetpack開發(fā):原理解析與應(yīng)用實(shí)戰(zhàn)
- OpenStack Cloud Computing Cookbook(Fourth Edition)
- Python爬蟲開發(fā)與項(xiàng)目實(shí)戰(zhàn)
- HTML5游戲開發(fā)案例教程
- JavaScript從入門到精通(第3版)
- Ext JS 4 Web Application Development Cookbook
- Mastering JBoss Enterprise Application Platform 7
- INSTANT Passbook App Development for iOS How-to
- Python時(shí)間序列預(yù)測(cè)
- Programming with CodeIgniterMVC
- Building Serverless Web Applications
- Hadoop 2.X HDFS源碼剖析
- Arduino Wearable Projects