Esempio n. 1
0
 /// <summary>
 /// Formats the number into the specified StringBuffer using the pattern of
 /// this DecimalFormat. If the field specified by the FieldPosition is
 /// formatted, set the begin and end index of the formatted field in the
 /// FieldPosition.
 /// </summary>
 ///
 /// <param name="number">the object to format</param>
 /// <param name="toAppendTo">the StringBuffer</param>
 /// <param name="pos">the FieldPosition</param>
 /// <returns>the StringBuffer parameter <c>buffer</c></returns>
 /// <exception cref="IllegalArgumentException">if the given number is not instance of <c>Number</c></exception>
 public sealed override StringBuilder FormatObject(Object number, StringBuilder toAppendTo,
                                                   FieldPosition pos)
 {
     if (!(number is ValueType))
     {
         throw new ArgumentException();
     }
     if (toAppendTo == null || pos == null)
     {
         throw new NullReferenceException();
     }
     if (number is Int64 || number is Decimal)
     {
         return(dform.FormatObject(number, toAppendTo, pos));
     }
     return(base.FormatObject(number, toAppendTo, pos));
 }