Sitecore 5.1.1 API

MainUtil.GetHashtable Method 

Gets a Hashtable from a list of objects.

[Visual Basic]
Public Shared Function GetHashtable( _
   ByVal objects As Object(), _
   ByVal nullIfEmpty As Boolean _
) As Hashtable
[C#]
public static Hashtable GetHashtable(
   object[] objects,
   bool nullIfEmpty
);

Parameters

objects
Objects.
nullIfEmpty
Indicates if the function should create a Hashtable even if there are not objects.

Return Value

A Hashtable containing the objects.

Remarks

If objects is null and nullIfEmpty is true, null is returned. If objects is null and nullIfEmpty is false, an empty Hashtable is returned.

Example

  Hashtable table1 = MainUtil.GetHashtable(new object[] { "Name1", "Value1", "Name2", "Value2"}, true);
  Hashtable table2 = MainUtil.GetHashtable(null, true); // null
  Hashtable table3 = MainUtil.GetHashtable(null, false); // Hashtable

See Also

MainUtil Class | Sitecore Namespace