- Beginning C# 7 Hands-On:Advanced Language Features
- Tom Owsiak
- 259字
- 2021-07-02 15:29:21
Starting a process from a web page
What we will do in this chapter is to learn how to open, for example, Notepad and then explore directly from a page. For this, go to Default.aspx, and enter the Design view. Double-click on the Show button. This takes us into Default.aspx.cs.
Delete the Page_Load block, so that it looks like the screen shown in Figure 5.5.1:

First, below the using System line, enter the following:
using System.Collections.Generic;
You add this line because we are dealing with dictionaries. Then, add one more line below this:
using System.Diagnostics;
You will see shortly why this line is needed. This is how you can start a process. A process, for example, refers to Notepad.
Now, between the set of curly braces beneath the line beginning with protected void Button1_Click..., enter the following:
Dictionary<string, string> filePrograms = new Dictionary<string, string>();
Hover your mouse over Dictionary and look at the pop-up tip, as shown in Figure 5.5.2. Do you see where it says TKey? This indicates the type of key, and TValue specifies the type of value. In our case, both will be of the string type:

Note that we give the dictionary a name such as filePrograms. Next, to make memory for it, enter new Dictionary<string, string> to indicate the type of key and the type of value and close this with a semicolon.
In the next stage, we will fill this dictionary. So, enter the following directly below this line:
filePrograms.Add("notepad.exe", @"c:\data\samplefile.txt");
- Getting Started with Citrix XenApp? 7.6
- Designing Machine Learning Systems with Python
- Python量化投資指南:基礎、數據與實戰
- 垃圾回收的算法與實現
- C++面向對象程序設計(微課版)
- Spring Boot+Spring Cloud+Vue+Element項目實戰:手把手教你開發權限管理系統
- Java程序員面試算法寶典
- Python應用輕松入門
- Apache Mahout Clustering Designs
- Learning Hunk
- Clojure Reactive Programming
- UI設計全書(全彩)
- Java并發編程之美
- RubyMotion iOS Develoment Essentials
- Python+Office:輕松實現Python辦公自動化