Share via


HttpRequestMessageExtensions.CreateResponse Method (, HttpStatusCode)

Namespace:  System.Net.Http
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function CreateResponse ( _
    request As HttpRequestMessage, _
    statusCode As HttpStatusCode _
) As HttpResponseMessage
'Usage
Dim request As HttpRequestMessage 
Dim statusCode As HttpStatusCode 
Dim returnValue As HttpResponseMessage 

returnValue = request.CreateResponse(statusCode)
public static HttpResponseMessage CreateResponse(
    this HttpRequestMessage request,
    HttpStatusCode statusCode
)
[ExtensionAttribute]
public:
static HttpResponseMessage^ CreateResponse(
    HttpRequestMessage^ request, 
    HttpStatusCode statusCode
)
static member CreateResponse : 
        request:HttpRequestMessage * 
        statusCode:HttpStatusCode -> HttpResponseMessage
public static function CreateResponse(
    request : HttpRequestMessage, 
    statusCode : HttpStatusCode
) : HttpResponseMessage

Parameters

  • request
    Type: HttpRequestMessage

Return Value

Type: HttpResponseMessage

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).

See Also

Reference

HttpRequestMessageExtensions Class

CreateResponse Overload

System.Net.Http Namespace