ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Data Namespace / VersionManager Class / GetVersion Method
The name of the Version to return.
Example

GetVersion Method (VersionManager)
Gets a Version object with the specified name. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public Version GetVersion( 
   string name
)

Parameters

name
The name of the Version to return.

Return Value

The Version that corresponds to name.
Exceptions
ExceptionDescription
A geodatabase-related exception has occurred.
This method or property must be called within the lambda passed to QueuedTask.Run
Example
Connecting to a Version
public Geodatabase ConnectToVersion(Geodatabase geodatabase, string versionName)
{
  Geodatabase connectedVersion = null;

  if (geodatabase.IsVersioningSupported())
  {
    using (VersionManager versionManager = geodatabase.GetVersionManager())
    using (Version version = versionManager.GetVersion(versionName))
    {
      connectedVersion = version.Connect();
    }
  }
  return connectedVersion;
}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

ArcGIS Pro version: 2.1 or higher.
See Also