ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

Format

Formats any value type

Source

public static string Format<T>(this T value, string format) where T : struct {
 return string.Format(format, value);
}

Example

Console.WriteLine(DateTime.Now.Format("It's {0:t}"));

Author: Patrick A. Lorenz

Submitted on: 19 mrt. 2008

Language: C#

Type: System.ValueType

Views: 4070