عندي كلاس لقراءة الكود من ملف كالتالي ...
public class ReadFromFile
{
FileStream f = null;
string fileName = "c:\\myData.data";
char [] separator = {' '};
string [] strArray;
int [,] pattern;
int [,] target;
int total = 0;
int count=1;
public ReadFromFile()
{
try
{
f = new FileStream(fileName,FileMode.Open,FileAccess.Read);
StreamReader r = new StreamReader(f);
string data = r.ReadLine();
for (int s=0;s<count;s++)
{
strArray = data.Split(separator);
pattern = new int [count,strArray.Length-16];
target= new int [count,16];
for (int i = 0; i <strArray.Length-16;i++)
{
pattern[s,i] = Convert.ToInt32(strArray);
}
for (int d = strArray.Length-16; d<strArray.Length; d++)
{
target[s,total] = Convert.ToInt32(strArray[d]);
total++;
}
data = r.ReadLine();
if(data !=null)
{
count++;
total = 0;
}
}
r.Close();
f.Close();
}
catch(IOException e)
{
Console.WriteLine(e.ToString());
}
finally
{
if ( f != null)
{
f.Close();
}
}
}
public int [,] inputDataArray
{
get
{
return this.pattern;
}
}
public int [,] outputDataArray
{
get
{
return this.target;
}
}
}المشكلة إني عندما أريد إستخدامه في Class آخر .. أقوم بعمل التالي
ReadFromFile g = new ReadFromFile(); int [,] inputArray= g.inputDataArray; int [,] outputArray = g.outputDataArray;
و لكنه يقوم بتحويل جميع ال arrays إلى أصفار ما عدا الأخيرة فهي تبقى صحيحة ..
ما السبب في ذلك أفيدوني لو سمحتم ..