微信枚举 字符中的转化

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 using System.Web.Script.Serialization;
 7 using System.Xml.Linq;
 8 using WeiXinApiSDK.Entities.Request;
 9 using WeiXinApiSDK.Entities.Response;
10 using WeiXinApiSDK.Extension;
11 using WeiXinApiSDK.Helpers;
12 using WeiXinApiSDK.Utilities;
13 
14 namespace Log
15 {
16 
17 
18     class Program
19     {
20 
21         public enum ReturnCode
22         {
23 
24             系统繁忙此时请开发者稍候再试 = -1,
25             请求成功 = 0,
26             获取access_token时AppSecret错误或者access_token无效 = 40001,
27             不合法的凭证类型 = 40002,
28             不合法的OpenID = 40003,
29             不合法的媒体文件类型 = 40004
30         }
31 
32 
33         public class WxJsonResult
34         {
35             public ReturnCode errcode { get; set; }
36             public string errmsg { get; set; }
37         }
38 
39         static void Main(string[] args)
40         {
41             JavaScriptSerializer js = new JavaScriptSerializer();
42             string cfff = "{\"errcode\":40003,\"errmsg\":\"invalid appid\"}";
43             WxJsonResult errorResult = js.Deserialize<WxJsonResult>(cfff);
44             ReturnCode f = errorResult.errcode;
45             var df= f.ToString();
46             int c = (int)ReturnCode.不合法的OpenID;
47 
48         }
49     }
50 }

 

posted on 2017-08-29 16:00  高达  阅读(103)  评论(0)    收藏  举报

导航