Disconnects the Layer from its underlying data source.

Namespace:  ESRI.ArcGISExplorer.Mapping

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public virtual void Disconnect()
Visual Basic (Declaration)
Public Overridable Sub Disconnect

Remarks

Use this method to release internal resources and place the Layer into an unconnected state. It is recommended that you disconnect a Layer if it is not being used in the map.

Examples

The code below shows how to open a FeatureLayer that references data in a file geodatabase, prints out the extent and coordinate system for the Layer, and disconnects the Layer from the underlying data.
CopyC#
//The static Open methods will return an instance of a concrete layer type.

//If the connection information specified is incorrect, an exception will be thrown, therefore
//use a try... catch block to handle the exception.
try
{
  //Open a FeatureLayer based on a File Geodatabase feature class
  FeatureLayer featureLayer = FeatureLayer.OpenFileGeodatabaseTable(@"C:\Data\Forestry.gdb", "road_hazards");

  //Print out coordinate system and extent of the layer- these properties can only be accessed when the layer is
  //connected to its underlying data source
  System.Diagnostics.Debug.Print(featureLayer.CoordinateSystem.ToString());
  System.Diagnostics.Debug.Print(featureLayer.Extent.ToString());

  //Finished accessing the data, so Disconnect the layer from its data source
  featureLayer.Disconnect();
}
catch (ESRI.ArcGISExplorer.ConnectionException ex)
{
  System.Diagnostics.Debug.Print(ex.Message);
}
CopyVB.NET
'The static Open methods will return an instance of a concrete layer type.


'If the connection information specified is incorrect, an exception will be thrown, therefore
'use a try... catch block to handle the exception.
Try
  'Open a FeatureLayer based on a File Geodatabase feature class
  Dim featureLayer As FeatureLayer = featureLayer.OpenFileGeodatabaseTable("C:\Data\Forestry.gdb", "road_hazards")

  'Print out coordinate system and extent of the layer- these properties can only be accessed when the layer is
  'connected to its underlying data source
  System.Diagnostics.Debug.Print(featureLayer.CoordinateSystem.ToString())
  System.Diagnostics.Debug.Print(featureLayer.Extent.ToString())

  'Finished accessing the data, so Disconnect the layer from its data source
  featureLayer.Disconnect()
Catch ex As ESRI.ArcGISExplorer.ConnectionException
  System.Diagnostics.Debug.Print(ex.Message)
End Try

See Also