Class DefaultArrayFormatProvider
Gets the default matrix representation, where each row is separated by a new line, and columns are separated by spaces.
Inherited Members
Namespace: ISynergy.Framework.Mathematics.Formats
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public sealed class DefaultArrayFormatProvider : MatrixFormatProviderBase, IMatrixFormatProvider
Remarks
This class can be used to convert to and from C# arrays and their string representation. Please see the example for details.
Examples
Converting from an array matrix to a string representation:
// Declare a number array
double[] x = { 5, 6, 7, 8 };
// Convert the aforementioned array to a string representation:
string str = x.ToString(DefaultArrayFormatProvider.CurrentCulture);
// the final result will be equivalent to
"5, 6, 7, 8"
Converting from strings to actual matrices:
// Declare an input string
string str = "5, 6, 7, 8";
// Convert the string representation to an actual number array:
double[] array = Matrix.Parse(str, DefaultArrayFormatProvider.InvariantCulture);
// array will now contain the actual number
// array representation of the given string.
Constructors
View SourceDefaultArrayFormatProvider(IFormatProvider)
Initializes a new instance of the DefaultArrayFormatProvider class.
Declaration
public DefaultArrayFormatProvider(IFormatProvider innerProvider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | innerProvider |
Properties
View SourceCurrentCulture
Gets the IMatrixFormatProvider which uses the CultureInfo used by the current thread.
Declaration
public static DefaultArrayFormatProvider CurrentCulture { get; }
Property Value
Type | Description |
---|---|
DefaultArrayFormatProvider |
InvariantCulture
Gets the IMatrixFormatProvider which uses the invariant system culture.
Declaration
public static DefaultArrayFormatProvider InvariantCulture { get; }
Property Value
Type | Description |
---|---|
DefaultArrayFormatProvider |