Decoding Query String with Unicode Characters

Recently I came across an issue where the query string had unicode characters and ASP.NET’s “HttpUtility.UrlDecode” was not properly converting the characters. After searching few minutes came across the following solution posted by cjsharp1 at Stackoverflow.

private string GetQueryStringValueFromRawUrl(string queryStringKey)
{
    var currentUri = new Uri(HttpContext.Current.Request.Url.Scheme + "://" + 
        HttpContext.Current.Request.Url.Authority + 
        HttpContext.Current.Request.RawUrl);
    var queryStringCollection = HttpUtility.ParseQueryString((currentUri).Query);
    return queryStringCollection.Get(queryStringKey);
}

Convert List<int> to List<string> in C#

I was faced with a micro challenge, of converting a List<int> to List<string>. After struggling for some time, decided to Google and found the the following solution !

List intList = new List();
List stringList = new List();

for (int i = 0; i < 10; i++)
	intList.Add(i);

stringList = intList.ConvertAll(delegate(int i) { return i.ToString(); });

Source: http://stackoverflow.com/questions/44942/cast-listint-to-liststring-in-net-2-0