Hi Nick,
Short of formatting the string yourself you are stuck with creating your
own class, which would format the string for you.
The string formatting part would look something like this
double[,] a = new Double[2, 2];
a[0, 0] = 1;
a[0, 1] = 2;
a[1, 0] = 3;
a[1, 1] = 4;
string s = "";
for (int i = 0; i <= a.GetUpperBound(0); i++)
{
s += "{";
for (int o = 0; o <= a.GetUpperBound(1); o++)
{
s += a[i, o].ToString() + ", ";
}
if (s.EndsWith(", "))
s = s.Substring(0, s.Length - 2);
s += "},";
}
if (s.EndsWith(","))
s = s.Substring(0, s.Length - 1);
MessageBox.Show(s);
On Mon, 22 Jan 2007 18:38:00 +0100, Nick Valeontis <nu*****@freemail.gr>
wrote:
Here is a snippet:
------------------------------
double[,] a = new Double[2,2];
a[0, 0] = 1;
a[0, 1] = 2;
a[1, 0] = 3;
a[1, 1] = 4;
MessageBox.Show(a.ToString());
result: System.Double[,]
------------------------------
Is there a way to customize ToString's returning value so that i can get
something like "{ 1 2},{3, 4}" - without having to create a new class;
With regards,
Nick
--
Happy Coding!
Morten Wennevik [C# MVP]