コード例 #1
0
 public string Format()
 {
     return(origin.Format()
            .Replace(" ", "/")
            .Replace(".", "/")
            .Replace(":", "/"));
 }
コード例 #2
0
        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();
        }
コード例 #3
0
        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()));
        }
コード例 #4
0
        public static string Invariant([CanBeNull] this IFormattable input)
        {
            Contract.Ensures(Contract.Result <string>() != null);

            return(input?.Format(CultureInfo.InvariantCulture) ?? string.Empty);
        }