ESRI.ArcGIS.ADF.IMS
Fields Property
See Also  Example
ESRI.ArcGIS.ADF.IMS.Data Namespace > Dataset Class : Fields Property




Gets the fields associated with a dataset.

Syntax

Visual Basic (Declaration) 
<XmlIgnoreAttribute()>
Public ReadOnly Property Fields As DataColumnCollection
Visual Basic (Usage)Copy Code
Dim instance As Dataset
Dim value As DataColumnCollection
 
value = instance.Fields
C# 
[XmlIgnoreAttribute()]
public DataColumnCollection Fields {get;}

Example

The following example prints a list of the field names in a FeatureLayer to a ListBox. The code assumes an existing MapView object.
C#Copy Code
// Get the fields for a feature layer 

FeatureLayer theLayer = (FeatureLayer) mapView.Layers.FindByName("Cities"); 

ESRI.ArcGIS.ADF.IMS.Data.StaticLayerDataset layerDataset = theLayer.Dataset as ESRI.ArcGIS.ADF.IMS.Data.StaticLayerDataset; 

DataColumnCollection layerFields = layerDataset.Fields; 

  

// Display the fields in a listbox - shows the column names 

ListBox1.DataSource = layerFields; 

ListBox1.DataBind(); 

    
Visual BasicCopy Code
' Get the fields for a feature layer

Dim theLayer As FeatureLayer = CType(mapView.Layers.FindByName("Cities"), FeatureLayer)

Dim layerDataset As ESRI.ArcGIS.ADF.IMS.Data.StaticLayerDataset

layerDataset = CType(theLayer.Dataset, ESRI.ArcGIS.ADF.IMS.Data.StaticLayerDataset)

Dim layerFields As DataColumnCollection = layerDataset.Fields



' Display the fields in a listbox - shows the column names

ListBox1.DataSource = layerFields

ListBox1.DataBind()

Remarks

Contains information about the attribute fields for a FeatureLayer. The Fields are a standard .NET DataColumnCollection. Individual columns can be examined to find the data type and name of the attribute fields.

This property will be null if the InitializationParameters used when creating the map has its LoadFields property set to false.

Fields will also be null for a Dataset associated with an ImageLayer.

See Also

© 2010 All Rights Reserved.