C# net core 实体转Url参数

        public static string ToUrlParams(this object obj) {

            return string.Join("&", obj.GetType().GetProperties().Where(x => x.GetValue(obj)!= null).Select(x => $"{x.Name}={HttpUtility.UrlEncode(x.value.ToString())}")); }

 

posted @ 2021-08-26 15:48  87de海雷  阅读(392)  评论(0)    收藏  举报