public string Format() { return(origin.Format() .Replace(" ", "/") .Replace(".", "/") .Replace(":", "/")); }
public void Print() { FileStream file = new FileStream(filename, FileMode.Create); StreamWriter writer = new StreamWriter(file); IFormattable formatter = DependencyResolver.Container.GetInstance <IFormattable>(); writer.Write(formatter.Format(words)); writer.Close(); file.Close(); }
public void IFormattableToStringWorks_SPI_1633_1651() { IFormattable s = FormattableStringFactory.Create("x = {0}, y = {0:FMT}", new MyFormattable()); // #1633 // #1651 Assert.AreEqual("x = Formatted: MyFormatProvider, y = Formatted: FMT, MyFormatProvider", s.Format(null, new MyFormatProvider())); }
public static string Invariant([CanBeNull] this IFormattable input) { Contract.Ensures(Contract.Result <string>() != null); return(input?.Format(CultureInfo.InvariantCulture) ?? string.Empty); }