MemoryExtensions.TryWrite 方法

定義

多載

TryWrite(Span<Char>, IFormatProvider, CompositeFormat, Int32, Object[])

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

TryWrite(Span<Char>, MemoryExtensions+TryWriteInterpolatedStringHandler, Int32)

將指定的插入字串寫入字元範圍。

TryWrite(Span<Char>, IFormatProvider, MemoryExtensions+TryWriteInterpolatedStringHandler, Int32)

將指定的插入字串寫入字元範圍。

TryWrite(Span<Char>, IFormatProvider, CompositeFormat, Int32, ReadOnlySpan<Object>)

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

TryWrite<TArg0,TArg1,TArg2>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0, TArg1, TArg2)

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

TryWrite<TArg0,TArg1>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0, TArg1)

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

TryWrite<TArg0>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0)

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

TryWrite(Span<Char>, IFormatProvider, CompositeFormat, Int32, Object[])

來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

public:
[System::Runtime::CompilerServices::Extension]
 static bool TryWrite(Span<char> destination, IFormatProvider ^ provider, System::Text::CompositeFormat ^ format, [Runtime::InteropServices::Out] int % charsWritten, ... cli::array <System::Object ^> ^ args);
public static bool TryWrite (this Span<char> destination, IFormatProvider? provider, System.Text.CompositeFormat format, out int charsWritten, params object?[] args);
static member TryWrite : Span<char> * IFormatProvider * System.Text.CompositeFormat * int * obj[] -> bool
<Extension()>
Public Function TryWrite (destination As Span(Of Char), provider As IFormatProvider, format As CompositeFormat, ByRef charsWritten As Integer, ParamArray args As Object()) As Boolean

參數

destination
Span<Char>

字串應該格式化的範圍。

provider
IFormatProvider

物件,提供特定文化特性格式資訊。

charsWritten
Int32

當這個方法傳回時,會包含寫入範圍中的字元數。

args
Object[]

要格式化的物件陣列。

傳回

true 如果可以成功格式化整個插補字串,則為 ;否則為 false

例外狀況

formatargsnull

格式專案的索引大於或等於提供的引數數目。

適用於

TryWrite(Span<Char>, MemoryExtensions+TryWriteInterpolatedStringHandler, Int32)

來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs

將指定的插入字串寫入字元範圍。

public:
[System::Runtime::CompilerServices::Extension]
 static bool TryWrite(Span<char> destination, MemoryExtensions::TryWriteInterpolatedStringHandler % handler, [Runtime::InteropServices::Out] int % charsWritten);
public static bool TryWrite (this Span<char> destination, ref MemoryExtensions.TryWriteInterpolatedStringHandler handler, out int charsWritten);
static member TryWrite : Span<char> * TryWriteInterpolatedStringHandler * int -> bool
<Extension()>
Public Function TryWrite (destination As Span(Of Char), ByRef handler As MemoryExtensions.TryWriteInterpolatedStringHandler, ByRef charsWritten As Integer) As Boolean

參數

destination
Span<Char>

應該格式化插補字串的範圍。

handler
MemoryExtensions.TryWriteInterpolatedStringHandler

以傳址方式傳遞的插補字串。

charsWritten
Int32

當這個方法傳回時,會包含寫入範圍中的字元數。

傳回

true 如果可以成功格式化整個插補字串,則為 ;否則為 false

適用於

TryWrite(Span<Char>, IFormatProvider, MemoryExtensions+TryWriteInterpolatedStringHandler, Int32)

來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs

將指定的插入字串寫入字元範圍。

public:
[System::Runtime::CompilerServices::Extension]
 static bool TryWrite(Span<char> destination, IFormatProvider ^ provider, MemoryExtensions::TryWriteInterpolatedStringHandler % handler, [Runtime::InteropServices::Out] int % charsWritten);
public static bool TryWrite (this Span<char> destination, IFormatProvider? provider, ref MemoryExtensions.TryWriteInterpolatedStringHandler handler, out int charsWritten);
static member TryWrite : Span<char> * IFormatProvider * TryWriteInterpolatedStringHandler * int -> bool
<Extension()>
Public Function TryWrite (destination As Span(Of Char), provider As IFormatProvider, ByRef handler As MemoryExtensions.TryWriteInterpolatedStringHandler, ByRef charsWritten As Integer) As Boolean

參數

destination
Span<Char>

應該格式化插補字串的範圍。

provider
IFormatProvider

物件,提供特定文化特性格式資訊。

handler
MemoryExtensions.TryWriteInterpolatedStringHandler

以傳址方式傳遞的插補字串。

charsWritten
Int32

當這個方法傳回時,會包含寫入範圍中的字元數。

傳回

true 如果可以成功格式化整個插補字串,則為 ;否則為 false

適用於

TryWrite(Span<Char>, IFormatProvider, CompositeFormat, Int32, ReadOnlySpan<Object>)

來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

public:
[System::Runtime::CompilerServices::Extension]
 static bool TryWrite(Span<char> destination, IFormatProvider ^ provider, System::Text::CompositeFormat ^ format, [Runtime::InteropServices::Out] int % charsWritten, ReadOnlySpan<System::Object ^> args);
public static bool TryWrite (this Span<char> destination, IFormatProvider? provider, System.Text.CompositeFormat format, out int charsWritten, ReadOnlySpan<object?> args);
static member TryWrite : Span<char> * IFormatProvider * System.Text.CompositeFormat * int * ReadOnlySpan<obj> -> bool
<Extension()>
Public Function TryWrite (destination As Span(Of Char), provider As IFormatProvider, format As CompositeFormat, ByRef charsWritten As Integer, args As ReadOnlySpan(Of Object)) As Boolean

參數

destination
Span<Char>

字串應該格式化的範圍。

provider
IFormatProvider

物件,提供特定文化特性格式資訊。

charsWritten
Int32

當這個方法傳回時,會包含寫入範圍中的字元數。

args
ReadOnlySpan<Object>

要格式化的物件範圍。

傳回

true 如果可以成功格式化整個插補字串,則為 ;否則為 false

例外狀況

formatnull

格式專案的索引大於或等於提供的引數數目。

適用於

TryWrite<TArg0,TArg1,TArg2>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0, TArg1, TArg2)

來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

public:
generic <typename TArg0, typename TArg1, typename TArg2>
[System::Runtime::CompilerServices::Extension]
 static bool TryWrite(Span<char> destination, IFormatProvider ^ provider, System::Text::CompositeFormat ^ format, [Runtime::InteropServices::Out] int % charsWritten, TArg0 arg0, TArg1 arg1, TArg2 arg2);
public static bool TryWrite<TArg0,TArg1,TArg2> (this Span<char> destination, IFormatProvider? provider, System.Text.CompositeFormat format, out int charsWritten, TArg0 arg0, TArg1 arg1, TArg2 arg2);
static member TryWrite : Span<char> * IFormatProvider * System.Text.CompositeFormat * int * 'TArg0 * 'TArg1 * 'TArg2 -> bool
<Extension()>
Public Function TryWrite(Of TArg0, TArg1, TArg2) (destination As Span(Of Char), provider As IFormatProvider, format As CompositeFormat, ByRef charsWritten As Integer, arg0 As TArg0, arg1 As TArg1, arg2 As TArg2) As Boolean

類型參數

TArg0

要格式化的第一個物件型別。

TArg1

要格式化的第二個物件型別。

TArg2

要格式化的第三個物件型別。

參數

destination
Span<Char>

字串應該格式化的範圍。

provider
IFormatProvider

物件,提供特定文化特性格式資訊。

charsWritten
Int32

當這個方法傳回時,會包含寫入範圍中的字元數。

arg0
TArg0

要格式化的第一個物件。

arg1
TArg1

要格式化的第二個物件。

arg2
TArg2

要格式化的第三個物件。

傳回

true 如果可以成功格式化整個插補字串,則為 ;否則為 false

例外狀況

formatnull

格式專案的索引大於或等於提供的引數數目。

適用於

TryWrite<TArg0,TArg1>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0, TArg1)

來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

public:
generic <typename TArg0, typename TArg1>
[System::Runtime::CompilerServices::Extension]
 static bool TryWrite(Span<char> destination, IFormatProvider ^ provider, System::Text::CompositeFormat ^ format, [Runtime::InteropServices::Out] int % charsWritten, TArg0 arg0, TArg1 arg1);
public static bool TryWrite<TArg0,TArg1> (this Span<char> destination, IFormatProvider? provider, System.Text.CompositeFormat format, out int charsWritten, TArg0 arg0, TArg1 arg1);
static member TryWrite : Span<char> * IFormatProvider * System.Text.CompositeFormat * int * 'TArg0 * 'TArg1 -> bool
<Extension()>
Public Function TryWrite(Of TArg0, TArg1) (destination As Span(Of Char), provider As IFormatProvider, format As CompositeFormat, ByRef charsWritten As Integer, arg0 As TArg0, arg1 As TArg1) As Boolean

類型參數

TArg0

要格式化的第一個物件型別。

TArg1

要格式化的第二個物件型別。

參數

destination
Span<Char>

字串應該格式化的範圍。

provider
IFormatProvider

物件,提供特定文化特性格式資訊。

charsWritten
Int32

當這個方法傳回時,會包含寫入範圍中的字元數。

arg0
TArg0

要格式化的第一個物件。

arg1
TArg1

要格式化的第二個物件。

傳回

true 如果可以成功格式化整個插補字串,則為 ;否則為 false

例外狀況

formatnull

格式專案的索引大於或等於提供的引數數目。

適用於

TryWrite<TArg0>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0)

來源:
MemoryExtensions.cs
來源:
MemoryExtensions.cs

CompositeFormat 字串寫入字元範圍,並以對應引數的字串表示取代格式專案或專案。

public:
generic <typename TArg0>
[System::Runtime::CompilerServices::Extension]
 static bool TryWrite(Span<char> destination, IFormatProvider ^ provider, System::Text::CompositeFormat ^ format, [Runtime::InteropServices::Out] int % charsWritten, TArg0 arg0);
public static bool TryWrite<TArg0> (this Span<char> destination, IFormatProvider? provider, System.Text.CompositeFormat format, out int charsWritten, TArg0 arg0);
static member TryWrite : Span<char> * IFormatProvider * System.Text.CompositeFormat * int * 'TArg0 -> bool
<Extension()>
Public Function TryWrite(Of TArg0) (destination As Span(Of Char), provider As IFormatProvider, format As CompositeFormat, ByRef charsWritten As Integer, arg0 As TArg0) As Boolean

類型參數

TArg0

要格式化之物件的型別。

參數

destination
Span<Char>

字串應該格式化的範圍。

provider
IFormatProvider

物件,提供特定文化特性格式資訊。

charsWritten
Int32

當這個方法傳回時,會包含寫入範圍中的字元數。

arg0
TArg0

要格式化的物件。

傳回

true 如果可以成功格式化整個插補字串,則為 ;否則為 false

例外狀況

formatnull

格式專案的索引大於或等於提供的引數數目。

適用於