You can use an indexer to return a single item from a list item collection. For example, if the collection is assigned to a variable named collListItems, use collListItems[index] in Microsoft C#, or collListItems(index) in Microsoft Visual Basic, where index is the index number of the item in the collection, or the internal name or display name of a list field. For an indexer based on a name, Microsoft SharePoint Foundation first looks for the field by internal name and then by display name.
To assign values to a field in a list item using an indexer, the values must be represented in a format that is appropriate for each built-in field type. The following table shows how the data types that are used in SharePoint Foundation field types map to Microsoft .NET Framework types.
Name | Format |
---|---|
Attachments
|
System.Boolean
|
Boolean
|
System.Boolean
|
Calculated
|
N/A
|
Choice
|
System.String
|
Computed
|
N/A
|
Counter
|
System.Int32
|
CrossProjectLink
|
System.Boolean
|
Currency
|
System.Double
|
DateTime
|
System.DateTime
|
GridChoice
|
System.String
|
Guid
|
System.Guid
|
Integer
|
System.Int32
|
Lookup
|
System.String
|
MaxItems
|
System.Int32
|
ModStat
|
System.Int32
|
MultiChoice
|
System.String
|
Note
|
System.String
|
Number
|
System.Double
|
Recurrence
|
System.Boolean
|
Text
|
System.String
|
Threading
|
System.String
|
URL
|
System.String, System.String
|
User
|
System.String
|
Note
|
System.String
|