FileInfo question

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello,

I create a file using FileInfo by :
NewFile = new FileInfo(FileName);

and I got a parameter which tells me in which folder I need to place it
on my filesystem.
How can I implement it on C# if I am getting _folderName and by using
FileInfo instance ?

Thank u!
 
Hi,

I do not understand what you need. If you are provided with a path and you
need to create a file you can use several ways to do that:

FileStream( path_supplied + "\\" + myfilename);
StreamWriter( path_supplied + "\\" + myfilename);
 
Hello,

I create a file using FileInfo by :
NewFile = new FileInfo(FileName);

and I got a parameter which tells me in which folder I need to place it
on my filesystem.
How can I  implement it on C# if I am getting _folderName and by using
FileInfo instance ?

It's news to me that the FileInfo Class can create a new file. From my
understanding, it only works with an existing file to obtain the file
properties of the file.
 
FileInfo does not create the file if it does not exist. Did I misunderstand
your first statement?

If you want a full path based on _foldername and FileName, use
Path.Combine(_foldername, FileName).
 
Back
Top