Class Fraction
Represents common fraction. Used to apply number format to the value.
Inherited Members
Namespace: Syncfusion.XlsIO.FormatParser
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public class Fraction
Constructors
Fraction(double)
Initializes a new instance of the Fraction class.
Declaration
public Fraction(double dNumerator)
Parameters
| Type | Name | Description |
|---|---|---|
| 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 |
|---|---|---|
| double | dNumerator | Represents numerator of the fraction. |
| double | dDenumerator | Represents denominator of the fraction. |
Properties
Denumerator
Gets or sets the fraction denumerator.
Declaration
public double Denumerator { get; set; }
Property Value
| Type |
|---|
| double |
DenumeratorLen
Gets the number of digits in the denumerator.
Declaration
public int DenumeratorLen { get; }
Property Value
| Type |
|---|
| int |
Numerator
Gets or sets the fraction numerator.
Declaration
public double Numerator { get; set; }
Property Value
| Type |
|---|
| double |
Methods
ConvertToFraction(double, int)
Converts number to fraction using required digits number.
Declaration
public static Fraction ConvertToFraction(double value, int iDigitsNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| double | value | Value to convert. |
| int | 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 |
|---|---|
| string | String representation of the Fraction. |
Overrides
Operators
operator +(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 operator double(Fraction)
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 |
|---|---|
| double | Double value equal to the fraction. |
explicit operator Fraction(List<double>)
Converts List into fraction.
Declaration
public static explicit operator Fraction(List<double> arrFraction)
Parameters
| Type | Name | Description |
|---|---|---|
| List<double> | arrFraction | List to convert. |
Returns
| Type | Description |
|---|---|
| Fraction | Converted value. |
explicit operator Fraction(double)
Converts long into fraction.
Declaration
public static explicit operator Fraction(double dValue)
Parameters
| Type | Name | Description |
|---|---|---|
| double | dValue | Value to convert. |
Returns
| Type | Description |
|---|---|
| Fraction | Converted value. |