using System; public class Example { public static string ExampleString = "Hello {0}".ToFormat("you!"); } /// /// Helper function to format a string without having to type 'string.format(...' /// public static class StringExtensionMethods { public static string ToFormat(this string s, object arg0) { return string.Format(s, arg0); } public static string ToFormat(this string s, object arg0, object arg1) { return string.Format(s, arg0, arg1); } public static string ToFormat(this string s, object arg0, object arg1, object arg2) { return string.Format(s, arg0, arg1, arg2); } public static string ToFormat(this string s, params object[] args) { return string.Format(s, args); } public static string ToFormat(this string s, IFormatProvider provider, string format, params object[] args) { return string.Format(provider, s, args); } } //csharp/8209