c#中的特殊字符表示问题

来源:互联网 发布:python 列表嵌套元组 编辑:程序博客网 时间:2024/04/27 22:01

转自:http://blog.csdn.net/zhl71199713/article/details/19846571

今天也遇到C#写json时使用string.format问题,参考该博客,便记录下来。

用两个连续的{}表示

        public void TEST()
        {
            try
            {
                string t = "Jim";
                string sresult = string.Format("{{name:\"{0}\"}}", t);
                Console.Write(sresult);
            }
            catch (Exception ex)
            {
            }
        }


C#中的其他类似特殊字符表示参考开头网址。

0 0