String.Create 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
Create(IFormatProvider, Span<Char>, DefaultInterpolatedStringHandler) |
使用指定的提供者來控制指定之插入字串的格式,以建立新的字串。 |
Create(IFormatProvider, DefaultInterpolatedStringHandler) |
使用指定的提供者來控制指定之插入字串的格式,以建立新的字串。 |
Create<TState>(Int32, TState, SpanAction<Char,TState>) |
使用指定的回呼,建立具有特定長度的新字串,並在建立後予以初始化。 |
Create(IFormatProvider, Span<Char>, DefaultInterpolatedStringHandler)
使用指定的提供者來控制指定之插入字串的格式,以建立新的字串。
public:
static System::String ^ Create(IFormatProvider ^ provider, Span<char> initialBuffer, System::Runtime::CompilerServices::DefaultInterpolatedStringHandler % handler);
public static string Create (IFormatProvider? provider, Span<char> initialBuffer, ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler handler);
static member Create : IFormatProvider * Span<char> * DefaultInterpolatedStringHandler -> string
Public Shared Function Create (provider As IFormatProvider, initialBuffer As Span(Of Char), ByRef handler As DefaultInterpolatedStringHandler) As String
參數
- provider
- IFormatProvider
物件,提供特定文化特性格式資訊。
- handler
- DefaultInterpolatedStringHandler
以傳址方式傳遞的插入字串。
傳回
產生使用指定的格式提供者來格式化插入字串的字串。
適用於
Create(IFormatProvider, DefaultInterpolatedStringHandler)
使用指定的提供者來控制指定之插入字串的格式,以建立新的字串。
public:
static System::String ^ Create(IFormatProvider ^ provider, System::Runtime::CompilerServices::DefaultInterpolatedStringHandler % handler);
public static string Create (IFormatProvider? provider, ref System.Runtime.CompilerServices.DefaultInterpolatedStringHandler handler);
static member Create : IFormatProvider * DefaultInterpolatedStringHandler -> string
Public Shared Function Create (provider As IFormatProvider, ByRef handler As DefaultInterpolatedStringHandler) As String
參數
- provider
- IFormatProvider
物件,提供特定文化特性格式資訊。
- handler
- DefaultInterpolatedStringHandler
以傳址方式傳遞的插入字串。
傳回
產生使用指定的格式提供者來格式化插入字串的字串。
適用於
Create<TState>(Int32, TState, SpanAction<Char,TState>)
使用指定的回呼,建立具有特定長度的新字串,並在建立後予以初始化。
public:
generic <typename TState>
static System::String ^ Create(int length, TState state, System::Buffers::SpanAction<char, TState> ^ action);
public static string Create<TState> (int length, TState state, System.Buffers.SpanAction<char,TState> action);
static member Create : int * 'State * System.Buffers.SpanAction<char, 'State> -> string
Public Shared Function Create(Of TState) (length As Integer, state As TState, action As SpanAction(Of Char, TState)) As String
類型參數
- TState
要傳遞至的元素類型 action
。
參數
- length
- Int32
要建立的字串長度。
- state
- TState
要傳遞至 action
的元素。
- action
- SpanAction<Char,TState>
初始化字串的回呼。
傳回
已建立的字串。
備註
傳遞至之目的範圍的初始內容 action
未定義。 因此,委派的責任是確保已指派範圍的每個元素。 否則,產生的字串可能會包含隨機字元。