Skip to content

719c29b8 acb2 4088 f1f4 83d959e34399

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

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

This method tries to convert provided value into string using provided format as well as 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,
	string format,
	IFormatProvider provider,
	out string result
)

Parameters

 

value
Type: TValue
The value to be converted.
format
Type: System.String
Any of the allowed format string of the type 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.

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 specific string formatting according to provided format.

See Also

Reference

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

Clone this wiki locally