C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String Format()The C# Format() method is used to replace one or more format items in the specified string with the string representation of a specified object. Signaturepublic static string Format (String first, Object second) public static string Format(IFormatProvider, String, Object) public static string Format(IFormatProvider, String, Object, Object) public static string Format(IFormatProvider, String, Object, Object, Object) public static string Format(IFormatProvider, String, Object[]) public static string Format(String, Object, Object) public static string Format(String, Object, Object, Object) public static string Format(String, params Object[]) Parametersfirst : it is a string type argument. second: it is object type argument. ReturnIt returns a formatted string. C# String Format() Method Exampleusing System; public class StringExample { public static void Main(string[] args) { string s1 = string.Format("{0:D}", DateTime.Now); Console.WriteLine(s1); } } Output: Saturday, December 17, 2016
Next TopicC# String GetEnumerator()
|