Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.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# 用于wcf服务的.net类生成器的json_C#_.net_Json_Wcf_Jira - Fatal编程技术网

C# 用于wcf服务的.net类生成器的json

C# 用于wcf服务的.net类生成器的json,c#,.net,json,wcf,jira,C#,.net,Json,Wcf,Jira,我有如下JIRA json字符串: [ { "self": "http://www.example.com/jira/rest/api/2/project/EX", "id": "10000", "key": "EX", "name": "Example", "avatarUrls": { "48x48": "http://www.example.com/jira/secure/projectavatar?size=large&pi

我有如下JIRA json字符串:

[
{
    "self": "http://www.example.com/jira/rest/api/2/project/EX",
    "id": "10000",
    "key": "EX",
    "name": "Example",
    "avatarUrls": {
        "48x48": "http://www.example.com/jira/secure/projectavatar?size=large&pid=10000",
        "24x24": "http://www.example.com/jira/secure/projectavatar?size=small&pid=10000",
        "16x16": "http://www.example.com/jira/secure/projectavatar?size=xsmall&pid=10000",
        "32x32": "http://www.example.com/jira/secure/projectavatar?size=medium&pid=10000"
    },
    "projectCategory": {
        "self": "http://www.example.com/jira/rest/api/2/projectCategory/10000",
        "id": "10000",
        "name": "FIRST",
        "description": "First Project Category"
    }
},
{
    "self": "http://www.example.com/jira/rest/api/2/project/ABC",
    "id": "10001",
    "key": "ABC",
    "name": "Alphabetical",
    "avatarUrls": {
        "48x48": "http://www.example.com/jira/secure/projectavatar?size=large&pid=10001",
        "24x24": "http://www.example.com/jira/secure/projectavatar?size=small&pid=10001",
        "16x16": "http://www.example.com/jira/secure/projectavatar?size=xsmall&pid=10001",
        "32x32": "http://www.example.com/jira/secure/projectavatar?size=medium&pid=10001"
    },
    "projectCategory": {
        "self": "http://www.example.com/jira/rest/api/2/projectCategory/10000",
        "id": "10000",
        "name": "FIRST",
        "description": "First Project Category"
    }
}
]
使用此()将其转换为.Net类。但是,我想在我的WCF服务中使用这个类。我是否需要向其中添加数据联系人和数据成员

我得到的头像url如下(这是我的类中的几行代码):

如果我将“属性属性”设置为数据成员。其结果如下所示:

    [DataContract]
    public class AvatarUrls
    {
        [DataMember(Name="48x48")]
        public string 48x48 { get; set; }
        [DataMember(Name="24x24")]
        public string 24x24 { get; set; }
        [DataMember(Name="16x16")]
        public string 16x16 { get; set; }
        [DataMember(Name="32x32")]
        public string 32x32 { get; set; }
    }
我在这里得到的错误是: 1.找不到类型或命名空间名称“x48”(缺少汇编引用) 2.字符串->预期的类、委托、枚举、接口或结构


我只是想知道,我可以在我的WCF代码中这样使用吗?我有点困惑,它对不对?怎么了?我错过什么了吗?请帮助。

48x48
等都是无效的标识符,请将它们更改为类似于
图标\u 48x48
的内容,并以与您相同的方式使用DataMember属性。

非常感谢您。错误现在已被删除。顺便问一下,这个头像URL是什么?为什么要使用它?我们不能忽略这一点吗?任何示例代码示例?化身是代表用户的小图标。如果你不关心用户的图片,那么是的,你可以忽略这些。
    [DataContract]
    public class AvatarUrls
    {
        [DataMember(Name="48x48")]
        public string 48x48 { get; set; }
        [DataMember(Name="24x24")]
        public string 24x24 { get; set; }
        [DataMember(Name="16x16")]
        public string 16x16 { get; set; }
        [DataMember(Name="32x32")]
        public string 32x32 { get; set; }
    }