//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
namespace System.ServiceModel.Channels
{
using System;
using System.Net.Http;
using System.Runtime;
///
/// A static extension methods class for getting a instance
/// from an instance.
///
public static class HttpResponseMessageExtensionMethods
{
///
/// An extension method for getting a instance
/// from an instance.
///
///
/// The instance can be read, written and copied
/// just as a traditional instance. The
/// instance can also "read" to retrieve the original
/// instance by calling the
///
/// Message.ToHttpResponseMessage() extension method.
///
/// The
/// from which to create the instance.
/// The new instance.
public static Message ToMessage(this HttpResponseMessage httpResponseMessage)
{
if (httpResponseMessage == null)
{
throw FxTrace.Exception.ArgumentNull("httpResponseMessage");
}
Message message = ByteStreamMessage.CreateMessage(httpResponseMessage, null);
message.ConfigureAsHttpMessage(httpResponseMessage);
return message;
}
}
}