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[])

Source:
MemoryExtensions.cs
Source:
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)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
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)

Source:
MemoryExtensions.cs
Source:
MemoryExtensions.cs
Source:
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>)

Source:
MemoryExtensions.cs
Source:
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);
public static bool TryWrite (this Span<char> destination, IFormatProvider? provider, System.Text.CompositeFormat format, out int charsWritten, scoped 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

例外

format null

格式项的索引大于或等于提供的参数数。

适用于

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

Source:
MemoryExtensions.cs
Source:
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

例外

format null

格式项的索引大于或等于提供的参数数。

适用于

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

Source:
MemoryExtensions.cs
Source:
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

例外

format null

格式项的索引大于或等于提供的参数数。

适用于

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

Source:
MemoryExtensions.cs
Source:
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

例外

format null

格式项的索引大于或等于提供的参数数。

适用于