Ejemplo n.º 1
0
 /// <summary>
 /// Clones the specified object by serializing &amp; deserializing it.
 /// </summary>
 /// <typeparam name="T">The type of the object</typeparam>
 /// <param name="data">The object to clone</param>
 /// <returns>The cloned object</returns>
 public static T Clone <T>(object data)
 {
     return(JSONSerializerHelper.DeserializeFromString <T>(JSONSerializerHelper.SerializeToString(data)));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Processes and deserializes the HttpResponse into a type-casted object.
 /// </summary>
 /// <param name="response">The HttpResponse to process</param>
 /// <param name="throwExceptionOnFailure">Throws an exception on a failed request</param>
 /// <returns>A type-casted object of the contents of the response</returns>
 public static async Task <T> ProcessResponse <T>(this HttpResponseMessage response, bool throwExceptionOnFailure = true)
 {
     return(JSONSerializerHelper.DeserializeFromString <T>(await response.ProcessStringResponse(throwExceptionOnFailure)));
 }