We have already seen all of the primitive value types supported by the C# language, using suffixes for literals (for example, 123L for a long) and various operations defined on them. However, some operations require use of static or instance members on those types. Let’s take a look.
One rather common operation used to obtain a primitive value is to parse external input, for example, coming from a database, directly from the user, or text-based stores such as XML files. In such a case, parsing a textual representation of a value into a proper value is needed.
Two methods exist on most primitive types that allow for precisely this:
TryParse. Their behavior differs in whether an exception gets thrown ...