FormatConverterT, TFormatTypeTryConvert Method |
Tries to convert the specified instance from one format to another, returning
success or failure.
Namespace:
AGI.Foundation.Infrastructure
Assembly:
AGI.Foundation.Core (in AGI.Foundation.Core.dll) Version: 24.2.419.0 (24.2.419.0)
Syntax public bool TryConvert(
TFormatType from,
TFormatType to,
T instance,
out T result
)
Public Function TryConvert (
from As TFormatType,
to As TFormatType,
instance As T,
<OutAttribute> ByRef result As T
) As Boolean
public:
bool TryConvert(
TFormatType from,
TFormatType to,
T instance,
[OutAttribute] T% result
)
member TryConvert :
from : 'TFormatType *
to : 'TFormatType *
instance : 'T *
result : 'T byref -> bool
Parameters
- from
- Type: TFormatType
The source TFormatType. - to
- Type: TFormatType
The destination TFormatType. - instance
- Type: T
The instance of T to convert.
- result
- Type: T
On return,
the resulting instance of T
equivalent to from, in the new
TFormatTypeto.
Return Value
Type:
Boolean if
from could be converted to the
requested
TFormatTypeto; otherwise
.
Exceptions Exception | Condition |
---|
ArgumentException |
Thrown when there is no conversion defined from from to to.
|
See Also