toArrayList() public method

public toArrayList ( ) : ArrayList
return System.Collections.ArrayList
Ejemplo n.º 1
0
 public static ArrayList ToArrayList(AssocArray value)
 {
     if (value == null) {
         return null;
     }
     return value.toArrayList();
 }
Ejemplo n.º 2
0
 public static Array ToArray(AssocArray value, Type conversionType, Encoding encoding)
 {
     if (value == null) {
         return null;
     }
     if (conversionType == null) {
         throw new ArgumentNullException("conversionType");
     }
     if (!conversionType.IsArray) {
         throw new ArgumentException("Must be an array type.");
     }
     if (conversionType == typeofObjectArray) {
         return value.toArrayList().ToArray();
     }
     try {
         return value.toArrayList().ToArray(conversionType.GetElementType());
     }
     catch (InvalidCastException) {
         ArrayList arraylist = value.toArrayList();
         Int32 length = arraylist.Count;
         Type elementType = conversionType.GetElementType();
         Array array = Array.CreateInstance(elementType, length);
         if (array.GetType() != conversionType) {
             throw new RankException("Only single dimension arrays are supported here.");
         }
         for (Int32 i = 0; i < length; i++) {
             array.SetValue(ChangeType(arraylist[i], elementType, encoding), i);
         }
         return array;
     }
 }