The TryParseIdent
method attempts to parse a given package identifier string into its constituent parts. This method is useful for validating and extracting information from package identifiers in the Sandbox environment.
The TryParseIdent
method attempts to parse a given package identifier string into its constituent parts. This method is useful for validating and extracting information from package identifiers in the Sandbox environment.
To use the TryParseIdent
method, provide a package identifier string as the input parameter. The method will attempt to parse this string and output the parsed components as a tuple. The method returns a boolean indicating whether the parsing was successful.
The output tuple contains the following components:
System.String
: The organization name.System.String
: The package name.System.Nullable<System.Int32>
: The version number, if specified.System.Boolean
: A flag indicating whether the package is local.string ident = "org:package@1"; if (Sandbox.Package.TryParseIdent(ident, out var parsed)) { string org = parsed.Item1; string package = parsed.Item2; int? version = parsed.Item3; bool isLocal = parsed.Item4; // Use the parsed values as needed } else { // Handle parsing failure }