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

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?

主站蜘蛛池模板: 灵石县| 乡宁县| 广平县| 东至县| 鞍山市| 广水市| 万荣县| 綦江县| 兰西县| 石阡县| 沁源县| 荔浦县| 和林格尔县| 和政县| 建宁县| 金堂县| 河曲县| 鄢陵县| 九寨沟县| 连江县| 句容市| 临邑县| 修文县| 清水县| 佳木斯市| 江安县| 特克斯县| 秀山| 敦煌市| 常山县| 浠水县| 罗定市| 彭山县| 白河县| 松桃| 黄浦区| 房产| 西盟| 屏山县| 莱州市| 临沭县|