Class CSharpJaggedMatrixFormatProvider
Gets the matrix representation used in C# jagged arrays.
Inherited Members
Namespace: ISynergy.Framework.Mathematics.Formats
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public sealed class CSharpJaggedMatrixFormatProvider : 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 a jagged matrix to a string representation:
// Declare a number array
double[][] x =
{
new double[] { 1, 2, 3, 4 },
new double[] { 5, 6, 7, 8 },
};
// Convert the aforementioned array to a string representation:
string str = x.ToString(CSharpJaggedMatrixFormatProvider.CurrentCulture);
// the final result will be equivalent to
"double[][] x = " +
"{ " +
" new double[] { 1, 2, 3, 4 }, " +
" new double[] { 5, 6, 7, 8 }, " +
"}"
Converting from strings to actual arrays:
// Declare an input string
string str = "double[][] x = " +
"{ " +
" new double[] { 1, 2, 3, 4 }, " +
" new double[] { 5, 6, 7, 8 }, " +
"}";
// Convert the string representation to an actual number array:
double[][] array = Matrix.Parse(str, CSharpJaggedMatrixFormatProvider.InvariantCulture);
// array will now contain the actual jagged
// array representation of the given string.
Constructors
View SourceCSharpJaggedMatrixFormatProvider(IFormatProvider)
Initializes a new instance of the CSharpJaggedMatrixFormatProvider class.
Declaration
public CSharpJaggedMatrixFormatProvider(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 CSharpJaggedMatrixFormatProvider CurrentCulture { get; }
Property Value
Type | Description |
---|---|
CSharpJaggedMatrixFormatProvider |
InvariantCulture
Gets the IMatrixFormatProvider which uses the invariant system culture.
Declaration
public static CSharpJaggedMatrixFormatProvider InvariantCulture { get; }
Property Value
Type | Description |
---|---|
CSharpJaggedMatrixFormatProvider |