我有一本字典在哪裏存儲密鑰和它們的路徑,我想檢查關鍵在註冊表C#中存在
檢查註冊表中已經存在的路徑,這是我的詞典:
public static Dictionary<string, string> AllRegKeys = new Dictionary<string,string>()
{
{"clientId", "MyApp\\credentials\\Identif"},
{"clientSecret", "MyApp\\credentials\\Identif"},
{"Key 1", "MyApp\\credentials\\Identif"},
{"key 2 ", "MyApp\\credentials\\Identif"},
{"using link ", "MyApp\\credentials\\Folder"},
{"category", "MyApp\\credentials\\Folder\\Cat"},
{"link1", "MyApp\\credentials\\Settings\\link"},
{"link2", "MyApp\\credentials\\Settings\\link"},
{"link3", "MyApp\\credentials\\Settings\\link"},
};
我試圖循環的字典,並嘗試在註冊表中的值和existant路徑之間進行比較,但我被困在這裏:
foreach (KeyValuePair<string, string> entry in ConstantsField.AllRegKeys)
{
if(entry.Value==)
}
請出示你爲了得到從註冊表中的信息都試過了。示例問題:[在C#中查找註冊表項](https://stackoverflow.com/q/13417955/6400526) –
嗨@GiladGreen,其實這就是我無法找到我正在考慮openSubKey,但我猜openSubKey只創建上午我錯了? – Code4Living
不確定,但我的意思是,您請求幫助以檢查您的字典值是否存在於註冊表中,但是您的代碼未顯示您實際訪問註冊表。請嘗試從註冊表中獲取信息 –