This is probably a very simple question but google has let me down sofar and keeps pointing me towards python solutions.
I have a webpage where applciations/users can supply querystringparameters
.To Retrieve the querystring parameters I use the following code:
IDictionary<string, string> qStrings = HtmlPage.Document.QueryString;
to check the presence of a specified key, I use the following code:
if (!String.IsNullOrEmpty(qStrings["PARAM1"]))
{}
Knowing our users, i'm expecting them to give parameterkeys as follows: "Param1", "param1", "pArAm1" How can simply cast every key in a dictionary to uppercase without iterating each key-valuepair?
Or how can i alter the qStrings["PARAM1"]
so it ignores the case?
!String.IsNullOrEmpty(qStrings["PARAM1"])
, that will crash ifPARAM1
doesn't exist. What you should do isif(qStrings.TryGetValue("PARAM1", out param1)) { ... }
– Litigateparam1
might benull
or empty string still though, so you might want to check that inside the{ ... }
– Litigate