Stringbuilder Appendformat in C#
C# Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | class Program { static void Main(string[] args) { StringBuilder stringb = new StringBuilder(); int intValue = 100; string stringValue = "red"; float floatValue = 15.50f; //position 0 is first variable and 1 is second variable and 2 third stringb.AppendFormat(" this is an int value: {0}. \n this is string value: {1} \n and it is float: {2}", intValue, stringValue, floatValue); Console.WriteLine(stringb.ToString()); Console.ReadLine(); } } |

How to use StringBuilder AppendFormat