ArcGIS Pro 2.6 API Reference Guide
ToXML Method (SpatialReference)
Example 

ArcGIS.Core.Geometry Namespace > SpatialReference Class : ToXML Method
Converts this spatial reference instance into an ArcGIS XML spatial reference representation.
Syntax
public string ToXML()
Public Function ToXML() As String

Return Value

Spatial reference represented as an XML string
Example
SpatialReference srWithVertical = SpatialReferenceBuilder.CreateSpatialReference(4326, 6916);

string xml = srWithVertical.ToXML();
SpatialReference importedSR = SpatialReferenceBuilder.FromXML(xml);
// importedSR.Wkid = 4326
// importedSR.VcsWkid = 6916

string json = srWithVertical.ToJson();
importedSR = SpatialReferenceBuilder.FromJson(json);
// importedSR.Wkid = 4326
// importedSR.VcsWkid = 6916
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

SpatialReference Class
SpatialReference Members