إشعار
يتطلب الوصول إلى هذه الصفحة تخويلاً. يمكنك محاولة تسجيل الدخول أو تغيير الدلائل.
يتطلب الوصول إلى هذه الصفحة تخويلاً. يمكنك محاولة تغيير الدلائل.
StringBuilder is so useful. Does it all. But it’s missing a method. Here it is:
/// <summary> /// Extends StringBuilder so that it has an AppendFormatLine method. /// </summary> /// <param name="value">The StringBuilder being extended.</param> /// <param name="format">A composite format string.</param> /// <param name="args">An object array that contains zero or more objects to format.</param> /// <returns>The StringBuilder.</returns> public static StringBuilder AppendFormatLine(this StringBuilder value, string format, params object[] args) { return value.AppendLine(string.Format(format, args)); }
So now you can simply code this:
stringBuilder.AppendFormatLine("Here's a line {0}", "YES!");
Instead of:
stringBuilder.AppendLine(String.Format("Here's a line {0}", "YES!"));
Just reads easier, and is simpler to dot through with IntelliSense.
Best,
Brian