ArcGIS Explorer Component Help |
DataDirectory Constructor |
DataDirectory Class Example See Also |
Initializes a new instance of the DataDirectory class using the specified file system path.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public DataDirectory( string directoryPath ) |
Visual Basic (Declaration) |
---|
Public Sub New ( _ directoryPath As String _ ) |
Parameters
- directoryPath
- Type: System..::.String
The path to the directory.
Return Value
A DataDirectory object representing a directory on disk.Remarks
Although a DataDirectory object can be created from any file system path, it only makes
sense to create one for a directory containing dBase files, shapefiles or raster format files.
Examples
The code below illustrates how to create a DataDirectory object which is then used to open a number of data types.
CopyC#
//Create a DataDirectory object for the specified file path DataDirectory dir = new DataDirectory(@"C:\Data"); //Print the path to the data System.Diagnostics.Debug.Print(dir.Path); //Prints "C:\Data" //Example 1 - open the mountains shapefile then print the name and whether it can store vector data. Table mtnsTable = dir.OpenTable("mountains"); System.Diagnostics.Debug.Print(mtnsTable.Name); //Prints "mountains" System.Diagnostics.Debug.Print(mtnsTable.IsSpatial.ToString()); //Prints "True" //Example 2 - open the mtn_ratings dBase file then print out the name and whether it can store vector data. Table ratingsTable = dir.OpenTable("mtn_ratings"); System.Diagnostics.Debug.Print(ratingsTable.Name); //Prints "mtn_ratings" System.Diagnostics.Debug.Print(ratingsTable.IsSpatial.ToString()); //Prints "False" //Example 3 - open the southgorms.jpg raster file and print the name Raster gormsRaster = dir.OpenRaster("northgorms.jpg"); System.Diagnostics.Debug.Print(gormsRaster.Name); //Prints "northgorms.jpg""
CopyVB.NET
'Create a DataDirectory object for the specified file path Dim dir As DataDirectory = New DataDirectory("C:\Data") 'Print the path to the data System.Diagnostics.Debug.Print(dir.Path) 'Prints "C:\Data" 'Example 1 - open the mountains shapefile then print the name and whether it can store vector data. Dim mtnsTable As Table = dir.OpenTable("mountains") System.Diagnostics.Debug.Print(mtnsTable.Name) 'Prints "mountains" System.Diagnostics.Debug.Print(mtnsTable.IsSpatial.ToString()) 'Prints "True" 'Example 2 - open the mtn_ratings dBase file then print out the name and whether it can store vector data. Dim ratingsTable As Table = dir.OpenTable("mtn_ratings") System.Diagnostics.Debug.Print(ratingsTable.Name) 'Prints "mtn_ratings" System.Diagnostics.Debug.Print(ratingsTable.IsSpatial.ToString()) 'Prints "False" 'Example 3 - open the southgorms.jpg raster file and print the name Dim gormsRaster As Raster = dir.OpenRaster("northgorms.jpg") System.Diagnostics.Debug.Print(gormsRaster.Name) 'Prints "northgorms.jpg"