Represents a number of records from the Table.

Namespace:  ESRI.ArcGISExplorer.Data

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

Syntax

C#
public class RowCollection : IEnumerable<Row>, 
	IEnumerable
Visual Basic (Declaration)
Public Class RowCollection _
	Implements IEnumerable(Of Row), IEnumerable

Remarks

There are three ways to return a RowCollection from a Table:

  • The GetRows method which can be used to return all or some of the rows by ID.
  • The Search method which can be used to perform attribute and spatial queries.
  • The SearchByDistance method which can be used to search a spatially enabled Table by proximity.
Additionally a RowCollection will be returned when looking-up related data in another Table using either the GetRelatedRows method or the Row.GetRelatedRows method. You can retrieve the first Row from a RowCollection using GetFirst method or sort a RowCollection using the Sort method.

Examples

The code below iterates over the rows stored in a RowCollection so that the locations of known road hazards can be exported to a text file which could then be read into a GPS.
CopyC#
{
  //Open polyline feature class
  Table forestRoadsTable = Table.OpenFileGeodatabaseTable(@"C:\Data\Forestry.gdb", "Road_Segments");

  //Return all the rows which make up a specific road
  RowCollection kershopRoadSegments = forestRoadsTable.Search(new Filter("NAME='Kershop91'"));

  //Road hazard information is stored in a point feature class called Road_Hazards which is related to the
  //Road_Segments Table by a geodatabase relationship class.  Return all the hazards on the Kershop91 road.
  RowCollection kershopRoadHazards = kershopRoadSegments.GetRelatedRows("RoadSegmentsRoadHazards");

  //Create a new text file.
  StreamWriter sw = new StreamWriter(@"C:\Data\HazardLocations.csv");

  //Write out the column header line
  sw.WriteLine("X,Y,Hazard");

  //Loop over each row in the RowCollection
  foreach (Row roadHazardRow in kershopRoadHazards)
  {
    //Get the location of the hazard
    ESRI.ArcGISExplorer.Geometry.Point hazardPnt = roadHazardRow.Geometry as ESRI.ArcGISExplorer.Geometry.Point;

    //The Hazard_Type Column stores values as integers, but it uses a CodedValueDomain
    //so look up the hazard description from the domain for this value
    String hazardType = roadHazardRow.Values.GetCodedName("Hazard_Type");

    //Write information to the text file
    if ((hazardPnt != null) && (hazardType != string.Empty))
    {
      sw.WriteLine("{0},{1},{2}", hazardPnt.X, hazardPnt.Y, hazardType);
    }
  }

  //Close the StreamWriter
  sw.Close();
}
CopyVB.NET
'Open polyline feature class
Dim forestRoadsTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\Forestry.gdb", "Road_Segments")

'Return all the line segments which make up a specific road
Dim kershopRoadSegments As RowCollection = forestRoadsTable.Search(New Filter("NAME='Kershop91'"))

'Road hazard information is stored in a point feature class called Road_Hazards which is related to the
'Road_Segments Table by a geodatabase relationship class.  Return all the hazards on the Kershop91 road.
Dim kershopRoadHazards As RowCollection = kershopRoadSegments.GetRelatedRows("RoadSegmentsRoadHazards")

'Create a new text file.
Dim sw As StreamWriter = New StreamWriter("C:\Data\HazardLocations.csv")

'Write out the column header line
sw.WriteLine("X,Y,Hazard")

'Loop over each row in the RowCollection
For Each roadHazardRow As Row In kershopRoadHazards
  'Get the location of the hazard
  Dim hazardPnt As ESRI.ArcGISExplorer.Geometry.Point = DirectCast(roadHazardRow.Geometry, ESRI.ArcGISExplorer.Geometry.Point)

  'The Hazard_Type Column stores values as integers, but it uses a CodedValueDomain
  'so look up the hazard description from the domain for this value
  Dim hazardType As String = roadHazardRow.Values.GetCodedName("Hazard_Type")

          'Write information to the text file
  If Not hazardPnt Is Nothing And Not hazardType Is String.Empty Then
    sw.WriteLine("{0},{1},{2}", hazardPnt.X, hazardPnt.Y, hazardType)
  End If
Next

'Close the StreamWriter
sw.Close()

Inheritance Hierarchy

System..::.Object

  ESRI.ArcGISExplorer.Data..::.RowCollection

See Also