Method TryFrom
- Namespace
- Ubiquity.NET.Versioning
- Assembly
- Ubiquity.NET.Versioning.dll
TryFrom(SemVer, out CSemVer, out Exception)
public static bool TryFrom(SemVer ver, out CSemVer result, out Exception reason)
Parameters
ver
SemVerVersion to convert
result
CSemVerResult or default if not convertible
reason
ExceptionReason that conversion is not allowed (or null if it is)
Returns
- bool
true if the conversion is performed or false if not (
reason
will hold reason it is not successful)
Remarks
While EVERY CSemVer conforms to valid SemVer the reverse is not always true. This method attempts to make a conversion using the classic try pattern with the inclusion of an exception that explains the reason for any failures. This is useful in debugging or for creating wrappers that will throw the exception.