开发者

How to append string representation of a specified object to a instance

开发者 https://www.devze.com 2023-03-31 03:18 出处:网络
I have a code like this: StringBuilder systemConditi开发者_如何学运维on = new StringBuilder();

I have a code like this:

StringBuilder systemConditi开发者_如何学运维on = new StringBuilder();
systemCondition.Append("^(");
systemCondition.Append(Regex.Escape(this.Class));
systemCondition.Append(" : ");
systemCondition.Append(Regex.Escape(this.Instance));
systemCondition.Append(")$");
m_afc.QualifiedInstanceFilter = systemCondition.ToString();

Can any body tell me whats wrong here? Then what about this code


If you just want more elegant code in one line, why not this?

m_afc.QualifiedInstanceFilter = string.Format("^({0} : {1})$", Regex.Escape(this.Class), Regex.Escape(this.Instance));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号