• 编码转换 C#


    static std::string cwstr_to_utf8(const std::wstring& in)
    {
        std::string s(in.length() * 3 + 1, ' ');
        size_t len = ::WideCharToMultiByte(CP_UTF8, 0, in.c_str(), in.length(), &s[0], s.length(), NULL, NULL);
        s.resize(len);
        return s;
    }

    static std::wstring cutf8_to_wstr(const std::string& in)
    {
        std::wstring s(in.length(), L' ');
        size_t len = ::MultiByteToWideChar(CP_UTF8, 0, in.c_str(), in.length(), &s[0], s.length());
        s.resize(len);
        return s;
    }

     User user = new User();
                user.Name = "张撒";
                user.Desc = "你好";
                JsonSerializerSettings setting = new JsonSerializerSettings();
                setting.StringEscapeHandling = StringEscapeHandling.Default;
                string json = JsonConvert.SerializeObject(user, setting);
                byte[] unicodeBytes = System.Text.Encoding.UTF8.GetBytes(json);
                string jsonutf8 = Encoding.UTF8.GetString(unicodeBytes);

    查看程序依赖

    https://www.cnblogs.com/liweis/p/17035963.html

    https://www.cnblogs.com/xcsn/p/9052360.html

    List<Type> TypeItemList = new List();
                //var ResultTypeList = Assembly.GetEntryAssembly();
                //if (ResultTypeList == null)
                //{
                //    ResultTypeList = Assembly.GetCallingAssembly();
                //    var ItemList = ResultTypeList.GetReferencedAssemblies().Where(p => p.GetType() == typeof(BaseService));                
                //}
                Assembly[] AssbyCustmList = System.AppDomain.CurrentDomain.GetAssemblies();
                foreach (Assembly assItem in AssbyCustmList)
                {
                    TypeItemList.AddRange(assItem.GetTypes().Where(x => x.BaseType == typeof(BaseService)).ToList());
                }
                //IEnumerable TypeItemList = CurType.Assembly.GetExportedTypes().Where(x => x.BaseType == typeof(BaseService)).ToList();
                //IEnumerable TypeItemList = ResultTypeList.GetTypes().Where(x => x.BaseType == typeof(BaseService)).ToList();
                BaseService TarService = null;
                foreach (Type typeitem in TypeItemList)
                {
                    if (_Reporttory.Count(p => p.GetType() == typeitem) == 0)
                    {
                        TarService = (Activator.CreateInstance(typeitem) as BaseService);
                    }
                    else
                    {
                        TarService = _Reporttory.First(p => p.GetType() == typeitem);
                    }
                    TarService.Start();
                }

  • 相关阅读:
    Vue的详细教程--用Vue-cli搭建SPA项目
    剑指offer——JZ32 从上往下打印二叉树 解题思路与具体代码【C++】
    go语言第四章
    SpringBoot+Kafka
    记录一次某MFC软件算法逆向之旅
    Go with Protobuf
    vue中的 this.$refs,this.$emit,this.$store,this.$nextTick 的使用
    【SQL性能优化】从数据页的角度理解B+树查询
    前言:自动化框架的设计模式
    从MediaRecord录像中读取H264参数
  • 原文地址:https://blog.csdn.net/csdn9990/article/details/133917280