FormattableString 類別

定義

代表複合格式字串以及要格式化的引數。

public ref class FormattableString abstract : IFormattable
public abstract class FormattableString : IFormattable
type FormattableString = class
    interface IFormattable
Public MustInherit Class FormattableString
Implements IFormattable
繼承
FormattableString
實作

備註

複合格式字串是由混合索引替代符號 (Placeholder) 的固定文字所組成 (這些符號稱為對應至清單內物件的格式項目)。 格式作業產生的結果字串是由原始固定文字所組成,這些固定文字混合了清單中代表物件的字串。 、 和 StringBuilder.AppendFormatString.FormatConsole.WriteLine 方法支援複合格式設定。 如需複合格式的詳細資訊,請參閱 複合格式設定。

FormattableString實例可能是 C# 或 Visual Basic 中的內插字串所產生。

建構函式

FormattableString()

執行個體化 FormattableString 類別的新執行個體。

屬性

ArgumentCount

取得要格式化的引數數目。

Format

傳回複合格式字串。

方法

CurrentCulture(FormattableString)

傳回結果字串,其引數會使用目前文化特性的慣例來格式化。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetArgument(Int32)

傳回在指定索引位置處的引數。

GetArguments()

傳回物件陣列,其中包含一或多個要格式化的物件。

GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
Invariant(FormattableString)

傳回結果字串,其引數是使用不因文化特性 (Culture) 而異的慣例來格式化。

MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回使用目前文化特性 (Culture) 的格式化慣例將複合格式字串及其引數格式化所產生的字串。

ToString(IFormatProvider)

傳回使用指定文化特性 (Culture) 的格式化慣例將複合格式字串及其引數格式化所產生的字串。

明確介面實作

IFormattable.ToString(String, IFormatProvider)

傳回使用指定文化特性 (Culture) 的格式化慣例將格式字串及其引數格式化所產生的字串。

適用於

另請參閱