WebInvokeAttribute.ResponseFormat Property

Definition

Gets or sets the ResponseFormat property.

C#
public System.ServiceModel.Web.WebMessageFormat ResponseFormat { get; set; }

Property Value

One of the WebMessageFormat enumeration values.

Examples

The following example shows how to set the ResponseFormat property.

C#
[OperationContract]
[WebInvoke(UriTemplate = "Div?x={x}&y={y}", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat=WebMessageFormat.Xml)]
long Divide(long x, long y);

Remarks

This property determines the format of responses sent from a service operation. The possible values are Xml and Json.

Applies to

Produkt Wersje
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1