Represents the values stored in an individual Row in the Table, with one value for each Column.

Namespace:  ESRI.ArcGISExplorer.Data

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

Syntax

C#
public class RowValueCollection : IEnumerable
Visual Basic (Declaration)
Public Class RowValueCollection _
	Implements IEnumerable

Remarks

A RowValueCollection can be returned for a Row using the Values property. It provides access to the actual data stored in a Row and consists of objects, one for each Column in the Table. To return a value for a particular column, use the indexer property on the collection in C# (using this[] syntax) or the Item property in VB.NET specifying the column name or index position. You can then cast the object to the appropriate type, checking the Type first if required.

A Column in a geodatabase feature class or table may have a CodedValueDomain associated with it (check using HasDomain property) and in these situations you can use the GetCodedName method to return the string description from the Domain rather than the actual value stored in the Column.

Examples

The code below provides three examples of how to access data stored in a Row using the RowValueCollection.
CopyC#
//Open Montgomery file geodatabase
Geodatabase gdb = new Geodatabase(@"C:\Data\Montgomery.gdb");

//Open the parcels featureclass
Table parcels = gdb.OpenTable("parcels");

//Get a single parcel
Row row = parcels.GetRow(3704);

//Get the RowValueCollection for this Row
RowValueCollection values = row.Values;

//Example 1 - iterate over the RowValueCollection using a 'for each' loop printing out the column values.
foreach (object val in values)
{
  System.Diagnostics.Debug.Print(val.ToString());
}

//Example 2- iterate over the RowValueCollection using a 'for' loop printing out the column names
//and their associated values. The coded value will be printed for any columns which have an
//associated coded value domain defined.
for (int i = 0; i < values.ColumnCount; i++)
{
  //Get the name of the column
  string columnName = values.Columns[i].Name;

  string rowValue = string.Empty;

  if ((values.Columns[i].HasDomain) && (values.Columns[i].GetDomain().Type == DomainType.CodedValue))
  {
    //Get the coded value if a coded value domain is defined against this column
    rowValue = values.GetCodedName(i);
  }
  else
  {
    //Get the actual value stored in the table
    rowValue = values[i].ToString();
  }

  //Print the column name and the value for every column in this Row
  System.Diagnostics.Debug.Print(string.Format("Column Name: {0}, Row Value: {1}", columnName, rowValue));
}

//Example 3 - Get values for individual columns

//Get the unique id value maintained by the geodatabase.
int uniqueID = (int)values[parcels.Columns.ObjectIDColumnName];
System.Diagnostics.Debug.Print(uniqueID.ToString());

//Get the actual value stored in the table for the 'Zoning_S' column
string zoningValue = (string)values["ZONING_S"];
System.Diagnostics.Debug.Print(zoningValue);  //Prints "R"

//Get the coded value stored in the domain associated with the 'Zoning_S' column
string zoningCodedDomainValue = (string)values.GetCodedName("ZONING_S");
System.Diagnostics.Debug.Print(zoningCodedDomainValue);   //Prints "Residential"
CopyVB.NET
'Open Montgomery file geodatabase
Dim gdb As Geodatabase = New Geodatabase("C:\Data\Montgomery.gdb")

'Open the parcels featureclass
Dim parcels As Table = gdb.OpenTable("parcels")

'Get a single parcel
Dim r As Row = parcels.GetRow(3704)

'Get the RowValueCollection for this Row
Dim values As RowValueCollection = r.Values

'Example 1 - iterate over the RowValueCollection using a 'for each' loop printing out the column values.
For Each val As Object In values
  System.Diagnostics.Debug.Print(val.ToString())
Next

'Example 2 - iterate over the RowValueCollection using a 'for' loop printing out the column names
'and their associated values. The coded value will be printed for any columns which have an
'associated coded value domain defined.
For i As Integer = 0 To values.ColumnCount - 1
  'Get the name of the column
  Dim columnName As String = values.Columns.Item(i).Name
  Dim rowValue As String = String.Empty

  If ((values.Columns.Item(i).HasDomain) And (values.Columns.Item(i).GetDomain().Type = DomainType.CodedValue)) Then

    'Get the coded value if a coded value domain is defined against this column
    rowValue = values.GetCodedName(i)

  Else
    'Get the actual value stored in the table
    rowValue = values.Item(i).ToString()
  End If

  'Print the column name and the value for every column in this Row
  System.Diagnostics.Debug.Print(String.Format("Column Name: {0}, Row Value: {1}", columnName, rowValue))

Next

'Example 3 - Get values for individual columns


'Get the unique id value maintained by the geodatabase.
Dim uniqueID As Integer = DirectCast(values.Item(parcels.Columns.ObjectIDColumnName), Integer)
System.Diagnostics.Debug.Print(uniqueID.ToString())

'Get the actual value stored in the table for the 'Zoning_S' column
Dim zoningValue As String = DirectCast(values.Item("ZONING_S"), String)
System.Diagnostics.Debug.Print(zoningValue)  'Prints "R"


'Get the coded value stored in the domain associated with the 'Zoning_S' column
Dim zoningCodedDomainValue As String = DirectCast(values.GetCodedName("ZONING_S"), String)
System.Diagnostics.Debug.Print(zoningCodedDomainValue)   'Prints "Residential"

Inheritance Hierarchy

System..::.Object

  ESRI.ArcGISExplorer.Data..::.RowValueCollection

See Also