Skip to content

34984874 3933 fe47 a00e 78a4cfa649fa

Axel Kesseler edited this page Mar 1, 2023 · 18 revisions

TypeFormatterExtension.TryFormat(TValue) Method (TValue, IFormatProvider, String, Exception)

This method tries to convert provided value into string using provided format provider.

Namespace: Plexdata.LogWriter.Internals.Extensions
Assembly: Plexdata.LogWriter.Abstraction (in Plexdata.LogWriter.Abstraction.dll) Version: 1.0.7.1

Syntax

C#

public static bool TryFormat<TValue>(
	this TValue value,
	IFormatProvider provider,
	out string result,
	out Exception error
)

Parameters

 

value
Type: TValue
The value to be converted.
provider
Type: System.IFormatProvider
The format provider to be used for conversion.
result
Type: System.String
The string representation of provided value if conversion was successful, and null if not.
error
Type: System.Exception
An exception instance to get extended error information.

Type Parameters

 

TValue
The type to be converted.

Return Value

Type: Boolean
True if conversion was successful and false otherwise.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

The provided value is converted using provided format provider and does not use any specific format string.

See Also

Reference

TypeFormatterExtension Class
TryFormat Overload
Plexdata.LogWriter.Internals.Extensions Namespace

Clone this wiki locally