Esempio n. 1
0
    /// <summary>
    /// Small function to parse the RequestParams object to URL friendly request
    /// </summary>
    /// <param name="reqObject"></param>
    /// <returns></returns>
    private string parseRequestObject(RequestParams reqObject)
    {
        var properties = from p in reqObject.GetType().GetProperties()
                         where p.GetValue(reqObject, null) != null
                         select p.Name + "=" + HttpUtility.UrlEncode(p.GetValue(reqObject, null).ToString());

        // TODO: Maybe some Sanitization here — Out of scope though of this Class.
        string queryString = String.Join("&", properties.ToArray());
        // Send back formatted
        return queryString;
    }