首页 > 其他 > 详细

string.Format 中不能包含{}字符串

时间:2015-04-17 08:22:38      阅读:256      评论:0      收藏:0      [点我收藏+]
string scss = @"<style type=""text/css"">
body{
    margin-left: {0}px;
    margin-top: {1}px;
}
</style>";
            scss = string.Format(scss, marginleft, margintop);

调试时提示string.Format格式错误,不太明白,后来将{}也作为修改字符串

        public void AddcssBody(int marginleft=2,int margintop=2)
        {
            string scss = @"<style type=""text/css"">
body{2}
    margin-left: {0}px;
    margin-top: {1}px;
{3}
</style>";
            scss = string.Format(scss, marginleft, margintop, "{", "}");
            Headary.Add(scss);
        }

正确显示.

string.Format 中不能包含{}字符串

原文:http://www.cnblogs.com/flyant/p/4433880.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!