🖥️How to use
How do you use SemanVer?
Using this library is very simple! Just use the SemanVer.Instance
namespace in any piece of code you want to use the library, as in: using SemanVer.Instance;
To parse your semantic version string, for example, 1.0.0-alpha1
, you must define a variable that has the type of SemVer. Assign a variable so that it calls the SemVer.Parse()
version, passing it your version string, like this:
Once the parser finishes parsing your semantic version string, it returns a class contains necessary information about your version:
Major version (
MajorVersion
,int
)Minor version (
MinorVersion
,int
)Patch version (
PatchVersion
,int
)Pre-Release info (
PreReleaseInfo
,string
)Build metadata (
BuildMetadata
,string
)
As for the equality operators, this class supports the following operators (assuming that SemVer a
has version 1.0.0 and SemVer b
has version 1.0.1):
==
: Checks to see if bothSemVer
versions are equal.!=
: Checks to see if bothSemVer
versions are opposite to each other.<
: Checks to see ifa
is older thanb
>
: Checks to see ifa
is newer thanb
<=
: Checks to see ifa
is older or equal tob
>=
: Checks to see ifa
is newer or equal tob
Last updated