Class Fraction
Represents common fraction. Used to apply number format to the value.
Inheritance
Namespace: Syncfusion.XlsIO.FormatParser
Assembly: Syncfusion.XlsIO.Portable.dll
Syntax
public class Fraction : Object
Constructors
Fraction(Double)
Initializes a new instance of the Fraction class.
Declaration
public Fraction(double dNumerator)
Parameters
Type | Name | Description |
---|---|---|
System.Double | dNumerator | Represents numerator of the fraction. |
Fraction(Double, Double)
Initializes a new instance of the Fraction class.
Declaration
public Fraction(double dNumerator, double dDenumerator)
Parameters
Type | Name | Description |
---|---|---|
System.Double | dNumerator | Represents numerator of the fraction. |
System.Double | dDenumerator | Represents denominator of the fraction. |
Properties
Denumerator
Gets or sets the fraction denumerator.
Declaration
public double Denumerator { get; set; }
Property Value
Type |
---|
System.Double |
DenumeratorLen
Gets the number of digits in the denumerator.
Declaration
public int DenumeratorLen { get; }
Property Value
Type |
---|
System.Int32 |
Numerator
Gets or sets the fraction numerator.
Declaration
public double Numerator { get; set; }
Property Value
Type |
---|
System.Double |
Methods
ConvertToFraction(Double, Int32)
Converts number to fraction using required digits number.
Declaration
public static Fraction ConvertToFraction(double value, int iDigitsNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | Value to convert. |
System.Int32 | iDigitsNumber | Maximum number of digits. |
Returns
Type | Description |
---|---|
Fraction | Optimal fraction. |
Reverse()
Swaps numerator and denumerator.
Declaration
public Fraction Reverse()
Returns
Type | Description |
---|---|
Fraction | Current fraction after reverse. |
ToString()
Returns string representation of the Fraction.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of the Fraction. |
Operators
Addition(Fraction, Fraction)
Initializes a new instance of the Fraction class.
Declaration
public static Fraction operator +(Fraction term1, Fraction term2)
Parameters
Type | Name | Description |
---|---|---|
Fraction | term1 | Represents first term of the fraction. |
Fraction | term2 | Represents second term of the fraction. |
Returns
Type | Description |
---|---|
Fraction | Fraction of the numerator and denominator. |
Explicit(Fraction to Double)
Converts fraction to double value.
Declaration
public static explicit operator double (Fraction fraction)
Parameters
Type | Name | Description |
---|---|---|
Fraction | fraction | Fraction to convert. |
Returns
Type | Description |
---|---|
System.Double | Double value equal to the fraction. |
Explicit(List<Double> to Fraction)
Converts List into fraction.
Declaration
public static explicit operator Fraction(List<double> arrFraction)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.Double> | arrFraction | List to convert. |
Returns
Type | Description |
---|---|
Fraction | Converted value. |
Explicit(Double to Fraction)
Converts long into fraction.
Declaration
public static explicit operator Fraction(double dValue)
Parameters
Type | Name | Description |
---|---|---|
System.Double | dValue | Value to convert. |
Returns
Type | Description |
---|---|
Fraction | Converted value. |