【发布时间】:2013-06-19 21:24:19
【问题描述】:
我有一个方法需要创建一个数组来保存根键的子键的名称,然后我需要另一个数组来保存所有这些子键中的值。我的困境是如何创建一个包含多个数组的多维数组?
到目前为止我的代码:
private void registryArrays() {
//Two string arrays for holding subkeys and values
string[] subKeys;
string[] values = new string[];
//reg key is used to access the root key CurrentUsers
RegistryKey regKey = Registry.CurrentUser;
RegistryKey regSubKey;
//Assign all subkey names from the currentusers root key
subKeys = regKey.GetSubKeyNames();
for (int i = 0; i < subKeys.Length; i++) {
regSubKey = regKey.OpenSubKey(subKeys[i]);
values[i] = regSubKey.GetValueNames();
}
}
我不知道该怎么做,因为 GetValueNames() 会给我一个数组,但是我需要获取多个数组,因为 for 循环将遍历我的根键的子键,所以我将如何把所有将数组合并为一个数组?
【问题讨论】:
标签: c# arrays winforms registry