Foxtable(狐表)用户栏目专家坐堂 → .net代码转换为VB


  共有5731人关注过本帖树形打印复制链接

主题:.net代码转换为VB

帅哥哟,离线,有人找我吗?
otterlike
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:103 积分:1228 威望:0 精华:0 注册:2017/5/16 22:42:00
.net代码转换为VB  发帖心情 Post By:2022/10/18 10:30:00 [只看该作者]

各位老师好!以下.net代码请问该如何转换为VB,感激不尽!

        static String Send(String apiName, String apiVersion, Dictionary<String, String> dict)

        {

            HttpWebRequest request = WebRequest.Create(URL) as HttpWebRequest;

            request.Method = "POST";

            request.ContentType = "application/json";

 

            // 设置请求参数

            dict.Add("_api_access_key", AK);

            dict.Add("_api_name", apiName);

            dict.Add("_api_version", apiVersion);

 

            // 对参数进行字典序排序

            List<KeyValuePair<string, string>> lst = new List<KeyValuePair<string, string>>(dict);

            lst.Sort(delegate (KeyValuePair<string, string> source, KeyValuePair<string, string> target)

            {

                return source.Key.CompareTo(target.Key);

            });

            StringBuilder signBuilder = new StringBuilder();

            StringBuilder paramBuilder = new StringBuilder();

 

            // 拼写请求字串

            foreach (KeyValuePair<string, string> item in lst)

            {

                string key = item.Key;

                string value = item.Value;

                // 签名字串

                signBuilder.Append("&").Append(key).Append("=").Append(value);

 

                //value = Server

                if (HEADERS.Contains(key))

                {

                    request.Headers[key] = value;

                }

                else

                {

                    paramBuilder.Append("&").Append(key).Append("=").Append(value);

                }

            }

 

            if(paramBuilder.Length>1) paramBuilder.Remove(0, 1);

            signBuilder.Remove(0, 1);

 

            string signStr = signBuilder.ToString();

 

        }

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110758 积分:563716 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/10/18 10:49:00 [只看该作者]


 回到顶部