Skip to content

Extensions

Extensions is a public module providing a single string extension method, ToInt, used internally by Version to normalize a version segment string into an integer for comparison purposes.

Purpose

  • Coerce a version segment string's leading digit run to an integer, treating non-numeric or conversion-failing input as 0, so that Version comparisons operate on numeric rather than string values.

Context

  • Namespace: SAIF.Framework.Version
  • Assembly/package: SAIF.Framework.Version

Public members

Member Signature Purpose
ToInt Public Function ToInt(value As String) As Integer (extension method on String) Extracts and converts the leading numeric portion of value to an Integer; returns 0 if value does not start with digits or if conversion otherwise fails. See BR-001.

Behavioral notes

  • ToInt wraps its conversion logic in a Try/Catch with an empty Catch block, silently swallowing any conversion exception and returning 0 rather than propagating the error.* See BR-001.
  • This method is used exclusively by Version's comparison operators and CompareTo to normalize Major, Minor, Build, and Revision segment values before comparing them numerically.*

Constraints and usage notes

  • ToInt requires the System.Text.RegularExpressions namespace to be imported for its leading-digit extraction logic.
  • Because conversion failures are silently coerced to 0, callers should not rely on ToInt to detect or surface malformed numeric input.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • SAIF.Framework.Version\Version.vb