ToString() public method

public ToString ( ) : string
return string
示例#1
0
 public static string Invariant(FormattableString formattable)
 {
     if (formattable == null)
     {
         throw new ArgumentNullException(nameof(formattable));
     }
     return formattable.ToString(CultureInfo.InvariantCulture);
 }
示例#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
     }
 }
示例#3
0
 public static string Invariant(FormattableString formattable)
 {
     if (formattable == null)
     {
         throw new ArgumentNullException("formattable");
     }
     return(formattable.ToString((IFormatProvider)CultureInfo.InvariantCulture));
 }
示例#4
0
        public static string Invariant(FormattableString formattable)
        {
            if (formattable == null)
            {
                throw new ArgumentNullException(nameof(formattable));
            }

            return(formattable.ToString(CultureInfo.InvariantCulture));
        }
示例#5
0
 public static string Invariant(FormattableString messageFormat)
 {
     return(messageFormat.ToString(CultureInfo.InvariantCulture));
 }
示例#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);
        }
示例#8
0
 static string Url(FormattableString str)
 {
     return str.ToString(UrlFormatProvider.Instance);
 }
示例#9
0
 public static string Invariant(FormattableString formattable) => formattable.ToString(CultureInfo.InvariantCulture);
示例#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);
        }
示例#11
0
 public static string Invariant (FormattableString formattable) => formattable.ToString(CultureInfo.InvariantCulture);
示例#12
0
 public void Log(FormattableString message)
 {
     Console.WriteLine($"{level}: {message.ToString(LoggingCulture)}");
 }
示例#13
0
 public static string Invariant(FormattableString formattable)
 {
     return(formattable.ToString(CultureInfo.InvariantCulture));
 }
示例#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));
 }
示例#15
0
 public static string Invariant(FormattableString formattable) =>
 formattable?.ToString(Globalization.CultureInfo.InvariantCulture);