-
Notifications
You must be signed in to change notification settings - Fork 0
3ab97e46 ee56 0924 bdb6 ef0c3018df64
TypeFormatterExtension.TryFormat(TValue) Method (TValue, String, IFormatProvider, String, Exception)
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.0.3
C#
public static bool TryFormat<TValue>(
this TValue value,
string format,
IFormatProvider provider,
out string result,
out Exception error
)
- 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, andnull
if not. - error
- Type: System.Exception
An exception instance to get extended error information.
- TValue
- The type to be converted.
Type: Boolean
True if conversion was successful and false otherwise.
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).
The provided value is converted using provided format provider and does specific string formatting according to provided format.
This method always returns false either if type of TValue is not supported, or if parameter provider is null
, or if any exception is thrown.
TypeFormatterExtension Class
TryFormat Overload
Plexdata.LogWriter.Internals.Extensions Namespace