MemoryExtensions.TryWrite Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
TryWrite(Span<Char>, IFormatProvider, CompositeFormat, Int32, Object[]) |
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments. |
TryWrite(Span<Char>, MemoryExtensions+TryWriteInterpolatedStringHandler, Int32) |
Writes the specified interpolated string to the character span. |
TryWrite(Span<Char>, IFormatProvider, MemoryExtensions+TryWriteInterpolatedStringHandler, Int32) |
Writes the specified interpolated string to the character span. |
TryWrite(Span<Char>, IFormatProvider, CompositeFormat, Int32, ReadOnlySpan<Object>) |
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments. |
TryWrite<TArg0,TArg1,TArg2>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0, TArg1, TArg2) |
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments. |
TryWrite<TArg0,TArg1>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0, TArg1) |
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments. |
TryWrite<TArg0>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0) |
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments. |
TryWrite(Span<Char>, IFormatProvider, CompositeFormat, Int32, Object[])
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.
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
Parameters
- provider
- IFormatProvider
An object that supplies culture-specific formatting information.
- format
- CompositeFormat
- charsWritten
- Int32
When this method returns, contains the number of characters written to the span.
- args
- Object[]
An array of objects to format.
Returns
true
if the entire interpolated string could be formatted successfully; otherwise, false
.
Exceptions
format
or args
is null
.
The index of a format item is greater than or equal to the number of supplied arguments.
Applies to
TryWrite(Span<Char>, MemoryExtensions+TryWriteInterpolatedStringHandler, Int32)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Writes the specified interpolated string to the character span.
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
Parameters
The interpolated string, passed by reference.
- charsWritten
- Int32
When this method returns, contains the number of characters written to the span.
Returns
true
if the entire interpolated string could be formatted successfully; otherwise, false
.
Applies to
TryWrite(Span<Char>, IFormatProvider, MemoryExtensions+TryWriteInterpolatedStringHandler, Int32)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Writes the specified interpolated string to the character span.
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
Parameters
- provider
- IFormatProvider
An object that supplies culture-specific formatting information.
The interpolated string, passed by reference.
- charsWritten
- Int32
When this method returns, contains the number of characters written to the span.
Returns
true
if the entire interpolated string could be formatted successfully; otherwise, false
.
Applies to
TryWrite(Span<Char>, IFormatProvider, CompositeFormat, Int32, ReadOnlySpan<Object>)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.
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
Parameters
- provider
- IFormatProvider
An object that supplies culture-specific formatting information.
- format
- CompositeFormat
- charsWritten
- Int32
When this method returns, contains the number of characters written to the span.
- args
- ReadOnlySpan<Object>
A span of objects to format.
Returns
true
if the entire interpolated string could be formatted successfully; otherwise, false
.
Exceptions
format
is null
.
The index of a format item is greater than or equal to the number of supplied arguments.
Applies to
TryWrite<TArg0,TArg1,TArg2>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0, TArg1, TArg2)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.
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
Type Parameters
- TArg0
The type of the first object to format.
- TArg1
The type of the second object to format.
- TArg2
The type of the third object to format.
Parameters
- provider
- IFormatProvider
An object that supplies culture-specific formatting information.
- format
- CompositeFormat
- charsWritten
- Int32
When this method returns, contains the number of characters written to the span.
- arg0
- TArg0
The first object to format.
- arg1
- TArg1
The second object to format.
- arg2
- TArg2
The third object to format.
Returns
true
if the entire interpolated string could be formatted successfully; otherwise, false
.
Exceptions
format
is null
.
The index of a format item is greater than or equal to the number of supplied arguments.
Applies to
TryWrite<TArg0,TArg1>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0, TArg1)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.
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
Type Parameters
- TArg0
The type of the first object to format.
- TArg1
The type of the second object to format.
Parameters
- provider
- IFormatProvider
An object that supplies culture-specific formatting information.
- format
- CompositeFormat
- charsWritten
- Int32
When this method returns, contains the number of characters written to the span.
- arg0
- TArg0
The first object to format.
- arg1
- TArg1
The second object to format.
Returns
true
if the entire interpolated string could be formatted successfully; otherwise, false
.
Exceptions
format
is null
.
The index of a format item is greater than or equal to the number of supplied arguments.
Applies to
TryWrite<TArg0>(Span<Char>, IFormatProvider, CompositeFormat, Int32, TArg0)
- Source:
- MemoryExtensions.cs
- Source:
- MemoryExtensions.cs
Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.
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
Type Parameters
- TArg0
The type of the object to format.
Parameters
- provider
- IFormatProvider
An object that supplies culture-specific formatting information.
- format
- CompositeFormat
- charsWritten
- Int32
When this method returns, contains the number of characters written to the span.
- arg0
- TArg0
The object to format.
Returns
true
if the entire interpolated string could be formatted successfully; otherwise, false
.
Exceptions
format
is null
.
The index of a format item is greater than or equal to the number of supplied arguments.