ScriptMethodAttribute.ResponseFormat プロパティ

定義

メソッドの応答形式を取得または設定します。

public:
 property System::Web::Script::Services::ResponseFormat ResponseFormat { System::Web::Script::Services::ResponseFormat get(); void set(System::Web::Script::Services::ResponseFormat value); };
public System.Web.Script.Services.ResponseFormat ResponseFormat { get; set; }
member this.ResponseFormat : System.Web.Script.Services.ResponseFormat with get, set
Public Property ResponseFormat As ResponseFormat

プロパティ値

ResponseFormat 値のいずれか 1 つ。 既定値は、Json です。

次の例は、 プロパティが に設定された ScriptMethodAttribute Web メソッドに 属性を適用する方法をResponseFormatXml示しています。 メソッドの戻り値は XML としてシリアル化され、 型 XmlDocumentのオブジェクトとして成功したコールバック関数に送信されます。 このコード例は、ScriptMethodAttribute クラスのために提供されている大規模な例の一部です。

注釈

戻り値の型の ResponseFormat 形式として XML を指定する場合は、 プロパティを使用します。 これは、 メソッドが オブジェクトまたは オブジェクトを返す XmlDocument 場合に XmlElement 便利です。

プロパティが ResponseFormatXml設定されている場合、属性が適用されている ScriptIgnoreAttribute 戻り値の型のパブリック フィールドとプロパティは無視されません。 これは、 オブジェクトではなく JavaScriptSerializer オブジェクトをXmlSerializer使用してシリアル化されるためです。 戻り値の型の XmlIgnoreAttribute パブリック フィールドとプロパティを無視またはスキップするには XmlSerializer 、 属性を適用する必要があります。

適用対象

こちらもご覧ください