SPFieldLookupValueCollection.ToString method

Returns the value collection as a string.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public override string ToString()

Return value

Type: System.String
A string that contains the value collection.

The string that is returned includes a series of substrings, each of which represents one value for a multiple value lookup. The substring for a single value has the following format:


In this format, Id is the identifier for the list item that the lookup field points to and Value is the value of the field that the lookup field points to. The two parts are delimited by the characters ";#". If Value contains a semicolon (";"), it is escaped with a semicolon (";;").

The same delimiter (";#") is used when multiple values are joined in a single string such as the one returned by the ToString method. For example, the following string represents the value of a multiple value lookup with two values:

3;#a field value;#7;#another field value