[]
Represents a PDF Number object. This class overrides and implements:
public class PdfNumber : IPdfNumber, IEquatable<PdfNumber>
Initializes a new instance of the PdfName class.
public PdfNumber(double value, int decimalPlaces)
value doubleThe value.
decimalPlaces intThe count of digits after decimal point.
Initializes a new instance of the PdfNumber class.
public PdfNumber(double value)
value doubleThe value.
Initializes a new instance of the PdfNumber class.
public PdfNumber(int value)
value intThe value.
Initializes a new instance of the PdfNumber class.
public PdfNumber(uint value)
value uintThe value.
Converts the PdfNumber to double.
public double AsDouble { get; }
Converts the PdfNumber to float.
public float AsFloat { get; }
Converts the PdfNumber to int. Note! The PdfNumber can contain a value does not fit into integer bounds, in this case result will be System.Int32.MinValue or System.Int32.MaxValue.
public int AsInt { get; }
public static IPdfObject Create(float? value)
value float?The value.
public bool Equals(PdfNumber other)
other PdfNumberAn object to compare with this object.
true if the current object is equal to the other parameter; otherwise, false.
public override bool Equals(object obj)
obj objectpublic override int GetHashCode()
Creates a new PdfNumber or returns existing predefined PdfNumber object.
public static PdfNumber GetOrCreate(int value)
value intpublic override string ToString()
Converts a double value to a string. Note that a separate method ToString(float, int) exists for converting float values, separate methods are needed to avoid rounding errors that may occur when converting doubles to floats and vice versa.
The value to convert. The count of digits after decimal point.public static string ToString(double value, int decimalPlaces)
value doubledecimalPlaces intConverts a float value to a string. Note that a separate method ToString(double, int) exists for converting double values, separate methods are needed to avoid rounding errors that may occur when converting doubles to floats and vice versa.
public static string ToString(float value, int decimalPlaces)
value floatThe value to convert.
decimalPlaces intThe count of digits after decimal point.
The equality operator.
public static bool operator ==(PdfNumber v1, PdfNumber v2)
Converts the double to the PdfNumber.
public static explicit operator PdfNumber(double d)
d doubleThe double value to convert.
Converts the PdfNumber to a double.
public static implicit operator double(PdfNumber pn)
The inequality operator.
public static bool operator !=(PdfNumber v1, PdfNumber v2)