官术网_书友最值得收藏!

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?

主站蜘蛛池模板: 兴义市| 泗水县| 木里| 改则县| 宣城市| 聂拉木县| 张掖市| 体育| 襄樊市| 卓尼县| 尚义县| 定安县| 阿瓦提县| 多伦县| 灌云县| 苍梧县| 蒲城县| 蕉岭县| 罗山县| 阿拉善盟| 弋阳县| 浦北县| 六枝特区| 宽城| 洛浦县| 肥乡县| 桦甸市| 合作市| 凤阳县| 北流市| 珠海市| 隆化县| 七台河市| 那坡县| 张家界市| 拉萨市| 通州区| 漠河县| 崇信县| 布尔津县| 梧州市|