I copy this code form StackOverlow question here, but I got feedback that it is not working on computers with specific datetime format. Do you have some idea how to fix it elegantly?
The problem is that the formating method is generic and object.ToString does not have overload with CultureInfo parameter.
private string UrlEncodeObject(object o)
{
var properties = from p in o.GetType().GetProperties()
where p.GetValue(o, null) != null
select p.Name + "=" + System.Net.WebUtility.UrlEncode(p.GetValue(o, null).ToString());
string queryString = String.Join("&", properties.ToArray());
return queryString;
}
I expect that there might be similar problems with specific decimal symbol etc.