HttpRequestMessageExtensions.CreateResponse<T> Method (, HttpStatusCode, T, HttpConfiguration)
Creates an HttpResponseMessage wired up to the associated HttpRequestMessage.
Namespace: System.Net.Http
Assembly: System.Web.Http (in System.Web.Http.dll)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Function CreateResponse(Of T) ( _
request As HttpRequestMessage, _
statusCode As HttpStatusCode, _
value As T, _
configuration As HttpConfiguration _
) As HttpResponseMessage
'Usage
Dim request As HttpRequestMessage
Dim statusCode As HttpStatusCode
Dim value As T
Dim configuration As HttpConfiguration
Dim returnValue As HttpResponseMessage
returnValue = request.CreateResponse(statusCode, _
value, configuration)
public static HttpResponseMessage CreateResponse<T>(
this HttpRequestMessage request,
HttpStatusCode statusCode,
T value,
HttpConfiguration configuration
)
[ExtensionAttribute]
public:
generic<typename T>
static HttpResponseMessage^ CreateResponse(
HttpRequestMessage^ request,
HttpStatusCode statusCode,
T value,
HttpConfiguration^ configuration
)
static member CreateResponse :
request:HttpRequestMessage *
statusCode:HttpStatusCode *
value:'T *
configuration:HttpConfiguration -> HttpResponseMessage
JScript does not support generic types and methods.
Type Parameters
- T
The type of the HTTP response message.
Parameters
request
Type: HttpRequestMessageThe HTTP request message which led to this response message.
statusCode
Type: System.Net.HttpStatusCodeThe HTTP response status code.
value
Type: TThe content of the HTTP response message.
configuration
Type: System.Web.Http.HttpConfigurationThe HTTP configuration which contains the dependency resolver used to resolve services.
Return Value
Type: HttpResponseMessage
An initialized HttpResponseMessage wired up to the associated HttpRequestMessage.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type HttpRequestMessage. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).