Message.GetFieldByIndex

Method

Visual Basic

Public Function GetFieldByIndex(
    ByVal fieldIndex As UInt32
) As MessageField

C#

public MessageField GetFieldByIndex(
    uint fieldIndex)

Purpose

Get a field from a message by an index.

Remarks

Programs can loop through all the fields of a message, to retrieve each field in turn using an integer index.

The method takes a snapshot of the field, and returns that information as a MessageField object. To obtain the value of the field, programs can either extract the Value property from the MessageField object explicitly, or implicitly extract its Value by assigning the object to a variable; see Implicit Conversions.

Add, remove and update calls can perturb the order of fields (which, in turn, affects the results when a program gets a field by index).

Parameter

Description

fieldIndex

Get the field with this index. Zero specifies the first field.