ToString() public method

public ToString ( ) : string
return string
Esempio n. 1
0
 public static string Invariant(FormattableString formattable)
 {
     if (formattable == null)
     {
         throw new ArgumentNullException(nameof(formattable));
     }
     return formattable.ToString(CultureInfo.InvariantCulture);
 }
Esempio n. 2
0
 public void Log(LogSeverity severity, string source, FormattableString message, Exception exception = null)
 {
     if (severity <= Level)
     {
         try { Message(this, new LogMessageEventArgs(severity, source, message.ToString(), exception)); }
         catch { } //We dont want to log on log errors
     }
 }
Esempio n. 3
0
 public static string Invariant(FormattableString formattable)
 {
     if (formattable == null)
     {
         throw new ArgumentNullException("formattable");
     }
     return(formattable.ToString((IFormatProvider)CultureInfo.InvariantCulture));
 }
Esempio n. 4
0
        public static string Invariant(FormattableString formattable)
        {
            if (formattable == null)
            {
                throw new ArgumentNullException(nameof(formattable));
            }

            return(formattable.ToString(CultureInfo.InvariantCulture));
        }
Esempio n. 5
0
 public static string Invariant(FormattableString messageFormat)
 {
     return(messageFormat.ToString(CultureInfo.InvariantCulture));
 }
Esempio n. 6
0
        /// <summary> 
        /// Format the given object in the invariant culture. This static method may be 
        /// imported in C# by 
        /// <code> 
        /// using static System.FormattableString; 
        /// </code>. 
        /// Within the scope 
        /// of that import directive an interpolated string may be formatted in the 
        /// invariant culture by writing, for example, 
        /// <code> 
        /// Invariant($""{{ lat = {latitude}; lon = {longitude} }}"") 
        /// </code> 
        /// </summary> 
        public static string Invariant(FormattableString formattable)
        {
            if (formattable == null)
            {
                throw new ArgumentNullException("formattable");
            }

            return formattable.ToString(Globalization.CultureInfo.InvariantCulture);
        }
        public static string Invariant(FormattableString formattableString)
        {
            string str = formattableString.ToString(CultureInfo.InvariantCulture);

            return(str);
        }
Esempio n. 8
0
 static string Url(FormattableString str)
 {
     return str.ToString(UrlFormatProvider.Instance);
 }
Esempio n. 9
0
 public static string Invariant(FormattableString formattable) => formattable.ToString(CultureInfo.InvariantCulture);
Esempio n. 10
0
        /// <summary>
        /// 将一个复合格式字符串转换为 <see cref="ExecuteCommand"/> 的对象实例。
        /// </summary>
        /// <param name="fs">一个复合格式字符串</param>
        /// <returns><see cref="ExecuteCommand"/> 的对象实例。</returns>
        public ExecuteCommand Parse(FormattableString fs)
        {
            if(fs == null) throw new ArgumentNullException(nameof(fs));

            var parameters = new ExecuteParameterCollection();
            var sfp = new SqlFormatProvider(parameters, this.Provider);
            var text = fs.ToString(sfp);
            return new ExecuteCommand(text, parameters);
        }
Esempio n. 11
0
 public static string Invariant (FormattableString formattable) => formattable.ToString(CultureInfo.InvariantCulture);
Esempio n. 12
0
 public void Log(FormattableString message)
 {
     Console.WriteLine($"{level}: {message.ToString(LoggingCulture)}");
 }
Esempio n. 13
0
 public static string Invariant(FormattableString formattable)
 {
     return(formattable.ToString(CultureInfo.InvariantCulture));
 }
Esempio n. 14
0
 /// <summary>
 /// Format the given object in the current culture. This static method may be
 /// imported in C# by
 /// <code>
 /// using static System.FormattableString;
 /// </code>.
 /// Within the scope
 /// of that import directive an interpolated string may be formatted in the
 /// current culture by writing, for example,
 /// <code>
 /// CurrentCulture($"{{ lat = {latitude}; lon = {longitude} }}")
 /// </code>
 /// </summary>
 public static string CurrentCulture(FormattableString formattable)
 {
     ArgumentNullException.ThrowIfNull(formattable);
     return(formattable.ToString(Globalization.CultureInfo.CurrentCulture));
 }
Esempio n. 15
0
 public static string Invariant(FormattableString formattable) =>
 formattable?.ToString(Globalization.CultureInfo.InvariantCulture);