B
Barry Young
I have the following .cs file: Hope you can read the code
In the Main() I want to pass the PathName and FileName and have the
FileStream object do a read, and return it into a string.
I can get intellisense to recognize Source.ReadSourceFile, but I haven't
figured out away to pass the parameters with this call in the Main():
string Test = Source.ReadSourceFile.Read("C:\\MyFile\\", "TestDir.txt");
Here it is:
using System;
using System.IO;
namespace Source
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class ReadSourceFile
{
public string Read(string PathName, string FileName)
{
System.IO.FileStream file = new System.IO.FileStream(PathName + FileName,
System.IO.FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(file);
string s = sr.ReadToEnd();
return s;
}
} }
public class main
{
string Test = Source.ReadSourceFile.Read("C:\\MyFile\\", "TestDir.txt");
}
///End code here
Any help would be appreciated!
Barry
In the Main() I want to pass the PathName and FileName and have the
FileStream object do a read, and return it into a string.
I can get intellisense to recognize Source.ReadSourceFile, but I haven't
figured out away to pass the parameters with this call in the Main():
string Test = Source.ReadSourceFile.Read("C:\\MyFile\\", "TestDir.txt");
Here it is:
using System;
using System.IO;
namespace Source
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public class ReadSourceFile
{
public string Read(string PathName, string FileName)
{
System.IO.FileStream file = new System.IO.FileStream(PathName + FileName,
System.IO.FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(file);
string s = sr.ReadToEnd();
return s;
}
} }
public class main
{
string Test = Source.ReadSourceFile.Read("C:\\MyFile\\", "TestDir.txt");
}
///End code here
Any help would be appreciated!
Barry