Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# RESTAPI数据契约支持xhtml_C#_Html_Xml_Json_Rest - Fatal编程技术网

C# RESTAPI数据契约支持xhtml

C# RESTAPI数据契约支持xhtml,c#,html,xml,json,rest,C#,Html,Xml,Json,Rest,我正在使用.NET为web应用程序提供RESTAPI。客户机希望以灵活的格式显示某些内容,以便来自服务器的数据可以确定要显示的格式。例如, 类别 这是一个测试类别 {这里是数据决定格式的部分,可以是2x2网格,也可以是3x5网格} 数据合同目前正在“使用系统”; 使用System.Runtime.Serialization [DataContract] public class Category { private readonly string m_description; p

我正在使用.NET为web应用程序提供RESTAPI。客户机希望以灵活的格式显示某些内容,以便来自服务器的数据可以确定要显示的格式。例如, 类别 这是一个测试类别 {这里是数据决定格式的部分,可以是2x2网格,也可以是3x5网格}

数据合同目前正在“使用系统”; 使用System.Runtime.Serialization

[DataContract]
public class Category
{
    private readonly string m_description;
    private readonly string m_data;

    public Category(string description, string data)
    {
        m_description = description;
        m_data = data;
    }

    [DataMember(Name = "description")]
    public string Description
    {
        get { return m_description; }
    }

    [DataMember(Name = "data")]
    public string Data
    {
        get { return m_data; }
    }
}`

我的问题是,该合同是否可以在数据字段中支持xhtml或html,以便将网格格式序列化到客户端?

进行了一些搜索,发现了使用WCF的类似问题,建议使用Stream作为类型以获得对数据格式的完全控制。不确定在使用ASP.NET Web API时是否有类似的解决方案。可能存在重复的