Use the String.Fornt to format a string using %.
String.Format format controls in C# also includes percentage (%) This multiplies the value by 100 and appends a percentage sign.
Let’s say our value is −
double val = .322;
Now, use String.Format and format −
string.Format("string = {0:0.0%}", val);The following is an example −
Example
using System;
public class Program {
public static void Main() {
double val = .322;
string res = string.Format("string = {0:0.0%}", val);
Console.WriteLine(res);
}
}Output
string = 32.2%