Sitecore 5.0 API

MainUtil.ConvertToString Method (NameValueCollection, String, String)

Converts a name/value collection to a single string.

[Visual Basic]
Overloads Public Shared Function ConvertToString( _
   ByVal col As NameValueCollection, _
   ByVal sep1 As String, _
   ByVal sep2 As String _
) As String
[C#]
public static string ConvertToString(
   NameValueCollection col,
   string sep1,
   string sep2
);

Parameters

col
A name/value collection.
sep1
The seperator between values.
sep2
The seperator between values paits.

Return Value

A string containing the name/value collection seperated by the seperator characters.

Remarks

If the collection is null, blank is returned.

Example

  ArrayList list = new ArrayList(new string[] {"Name1", "Value1", "Name2", "Value2"});
  NameValueCollection collection = MainUtil.ConvertToNamevalues(list);
  string s = MainUtil.ConvertToString(collection, ", ", " and "); // "Name1, Value1 and Name2, Value2"

See Also

MainUtil Class | Sitecore Namespace | MainUtil.ConvertToString Overload List