string[,] desc = new string[255,10];
int descLines = 0;
cont string RDATAPATCH = "rctdata.xdb";
using (StreamReader sr = new StreamReader(RDATAPATCH))
{
descLines = 0;
while (sr.Peek() > -1)
{
sr.ReadLine();
descLines++;
}
desc = new string[descLines, 10];
int line = 0;
sr.BaseStream.Position = 0;
sr.DiscardBufferedData();
while (sr.Peek() > -1)
{
string ltxt = sr.ReadLine();
string[] lstxt = ltxt.Split('|');
for (int x = 0; x < 10; x++)
{
desc[line, x] = lstxt[x];
}
line++;
}
}
string[] sArray = new string[descLines];
for (int x = 0; x < descLines; x++)
{
sArray[x] = desc[x, 7];
}
Array.Sort(sArray);
string[,] tempDesc = new string[descLines, 10];
for (int x = 0; x < sArray.Length; x++)
{
for (int y = 0; y < desc.Length / 10; y++)
{
if (sArray[x] == desc[y, 7])
{
for (int z = 0; z < 10; z++)
{
tempDesc[x, z] = desc[y, z];
}
}
}
}
desc = tempDesc;
I have this code and the file that streamreader load is like this:
id|rid|type|date opened|code|<0/1>|<number>|open date|availability('in stoc' or '11.11.2010'>|<0/1/2>
0|0|15fl*20ml/cut|04.2012|200905.101109|1|1|nedeschis|in stoc|2
1|0|15fl*20ml/cut|07.2012|200905.030210|1|1|nedeschis|in stoc|2
2|10|150 teste/cut|11.2012|16813A|1|3|nedeschis|in stoc|2
3|0|15fl*20ml/cut|06.2011|200905.050309|0|11|07.07.2010|in stoc|0
the desc variable is sorted by the open date string and can be: 'nedeschis'(closed) or '11.11.2010'(a date). I think that my algorithm is wrong can anyone help me?