FormattableString.Invariant(FormattableString) FormattableString.Invariant(FormattableString) FormattableString.Invariant(FormattableString) FormattableString.Invariant(FormattableString) Method

定義

傳回結果字串,其引數是使用不因文化特性 (Culture) 而異的慣例來格式化。Returns a result string in which arguments are formatted by using the conventions of the invariant culture.

public:
 static System::String ^ Invariant(FormattableString ^ formattable);
public static string Invariant (FormattableString formattable);
static member Invariant : FormattableString -> string
Public Shared Function Invariant (formattable As FormattableString) As String

參數

formattable
FormattableString FormattableString FormattableString FormattableString

要轉換為結果字串的物件。The object to convert to a result string.

傳回

使用不因文化特性 (Culture) 而異的慣例將目前執行個體格式化所產生的字串。The string that results from formatting the current instance by using the conventions of the invariant culture.

例外狀況

備註

這個靜態方法可以在 C# 中匯入下列陳述式:This static method can be imported in C# by the following statement:

using static System.FormattableString;  

範圍內,using static指示詞,字串插值可能使用文化特性而異的慣例來格式化程式碼,如下所示:Within the scope that using static directive, an interpolated string may be formatted using the conventions of the invariant culture by code such as the following:

Invariant($"{{ lat = {latitude}; lon = {longitude} }}")   

適用於