Elad770
Member
- Joined
- Oct 4, 2021
- Messages
- 20
- Programming Experience
- 1-3
Hello
I have a problem and I have no idea why it is happening.
I am trying to run a class from a dll file, one of whose functions reads from a text file in the debug folder by the StreamReader class.
The problem is that when I run the additional project that calls the class from the first project and the function in question is run, I get the path of the second project and not of the dll? what is the mistake.
Here is the code:
I have a problem and I have no idea why it is happening.
I am trying to run a class from a dll file, one of whose functions reads from a text file in the debug folder by the StreamReader class.
The problem is that when I run the additional project that calls the class from the first project and the function in question is run, I get the path of the second project and not of the dll? what is the mistake.
Here is the code:
C#:
namespace LibraryDiagnosis
{
public class Diagnostic
{
Dictionary<string, double[][]> ranges;
public Diagnostic()
{
CreateAllRanges();
}
private void CreateAllRanges()
{
//Create all standard test ranges
ranges = new Dictionary<string, double[][]>();
string line;
//error path file
using (StreamReader file = new StreamReader("metrics.txt"))
{
while ((line = file.ReadLine()) != null)
{
string[] delimiters = line.Split(new char[] { ',' });
double[][] dou = new double[int.Parse(delimiters[1].ToString())][];
for (int i = 2,j=0; i < delimiters.Length; i+=2,j++)
{
dou[j] = new double[2];
dou[j][0] = double.Parse(delimiters[i].ToString());
dou[j][1] = double.Parse(delimiters[i+1].ToString());
}
ranges.Add(delimiters[0].ToString(), dou);
}
file.Close();
}
}
}
//project two console
using LibraryDiagnosis;
Diagnostic dia = new Diagnostic();