在ASP.NET我可以檢查查詢字符串鍵/值的存在,像這樣如何檢查NavigationContext.QueryString?
if(Request.QueryString["someValue"] != null)
但是,我不能NavigationContext.QueryString
if(NavigationContext.QueryString["someValue"] != null)
這樣做會引發錯誤 - The given key was not present in the dictionary
還拋出一個錯誤。該代碼位於OnNavigatedTo
方法中。
如何檢查Windows Phone 8的鍵/值的存在?我目前醜陋醜陋的解決方法是將每個塊封裝在try/catch中,catch塊中沒有代碼。如果密鑰存在,則代碼完成,否則它會拋出錯誤,這是默默捕捉的。
我檢查的OnNavigatedTo。我得到的錯誤是'給定的鍵沒有出現在字典中' – roryok