public NewT[] ToArray <NewT>(IFormatProvider fmtProvider) { NewT[] array = new NewT[Count]; for (int i = 0; i < Count; i++) { array[i] = (NewT)Utils.ChangeType(this[i], typeof(NewT), fmtProvider); // throws InvalidCastException, FormatException, OverflowException } return(array); }
public NewT[] ToArray <NewT>(IFormatProvider fmtProvider) { NewT[] array = new NewT[mItems.Count]; int i = 0; foreach (T item in mItems.Keys) { array[i++] = (NewT)Utils.ChangeType(item, typeof(NewT), fmtProvider); // throws InvalidCastException, FormatException, OverflowException } return(array); }
public NewT[] ToArray <NewT>(IFormatProvider fmtProvider) { NewT[] array = new NewT[GetCount()]; int i = 0; foreach (KeyValuePair <T, int> item in mItems) { for (int j = 0; j < item.Value; j++) { array[i++] = (NewT)Utils.ChangeType(item.Key, typeof(NewT), fmtProvider); // throws InvalidCastException, FormatException, OverflowException } } return(array); }