ArcGIS Pro 2.7 API Reference Guide
ChangeVersion(Version,Version) Method
Example 

ArcGIS.Desktop.Mapping Namespace > Map Class > ChangeVersion Method : ChangeVersion(Version,Version) Method
Version object you want to find and replace with toVersion.
Version object you want to replace to.
Change GeoDatabase version of layers and standalone tables of fromVersion. This method must be called on the MCT. Use QueuedTask.Run
Syntax
public void ChangeVersion( 
   Version fromVersion,
   Version toVersion
)
Public Overloads Sub ChangeVersion( _
   ByVal fromVersion As Version, _
   ByVal toVersion As Version _
) 

Parameters

fromVersion
Version object you want to find and replace with toVersion.
toVersion
Version object you want to replace to.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
This operation is not supported on a map with pending edits.
Example
Change Geodatabase Version of layers off a specified version in a map.
await QueuedTask.Run(() =>
{
        //Getting the current version name from the first feature layer of the map
        FeatureLayer flyr = MapView.Active.Map.GetLayersAsFlattenedList()
                .OfType<FeatureLayer>().FirstOrDefault();  //first feature layer
        Datastore dataStore = flyr.GetFeatureClass().GetDatastore();  //getting datasource
        Geodatabase geodatabase = dataStore as Geodatabase; //casting to Geodatabase
        if (geodatabase == null)
    return;

  VersionManager versionManager = geodatabase.GetVersionManager();
  ArcGIS.Core.Data.Version currentVersion = versionManager.GetCurrentVersion();

        //Getting all available versions except the current one
        IEnumerable<ArcGIS.Core.Data.Version> versions = versionManager.GetVersions()
                .Where(v => !v.GetName().Equals(currentVersion.GetName(), StringComparison.CurrentCultureIgnoreCase));

        //Assuming there is at least one other version we pick the first one from the list
        ArcGIS.Core.Data.Version toVersion = versions.FirstOrDefault();
  if (toVersion != null)
  {
          //Changing version
          MapView.Active.Map.ChangeVersion(currentVersion, toVersion);
  }
});
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

Map Class
Map Members
Overload List