请问泛型集合可以储存文件吗?

来源:百度知道 编辑:UC知道 时间:2024/05/28 17:56:45
C# 复制代码
// Create a new dictionary of strings, with string keys.
//
Dictionary<string, string> openWith =
new Dictionary<string, string>();

// Add some elements to the dictionary. There are no
// duplicate keys, but some of the values are duplicates.
openWith.Add("txt", "notepad.exe");
openWith.Add("bmp", "paint.exe");
openWith.Add("dib", "paint.exe");
openWith.Add("rtf", "wordpad.exe");

// The Add method throws an exception if the new key is
// already in the dictionary.
try
{
openWith.Add("txt", "winword.exe");
}
catch (ArgumentException)
{
Console.WriteLine("An element with Key = \"txt\" already exists.");
}

我看MSDN的例子

它是只存了"xxx.exe"字符串的值而已还是可以储存可运行文件?
啊,我怎么没看出有文件目录呢?只有文件名

这段代码演示了如何使用泛型集合类 注册打开何种扩展名文件时所采用的可执行文件或应用程序名."xxx.exe" 你可以理解为 调用该可执行文件时所需要访问的文件全路径
---------------------------------
这仅仅是个例子...