Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear all,

Could you explain me about file System in C# programming? I don't know what is it? Do you know any link that I can download this document to read? Could you tell me?

Thank you so much.
Posted
Comments
Al Moje 13-Dec-11 3:33am    
Hi, Google is you friend...

There is no "file system" in C# as such - the .NET framework provides a few classes to interface with the operating system file system, most notably:
File Class[^]
FileInfo Class[^]
Directory Class[^]
DirectoryInfo Class[^]
Stream Class[^] - though you would normally use derived classes rather than the base Stream directly.
 
Share this answer
 
Comments
[no name] 13-Dec-11 3:42am    
5!
phanny 2011 13-Dec-11 3:44am    
So If the teacher let me search about file system, so I have to put
File Class
FileInfo Class
Directory Class
DirectoryInfo Class
and Stream Class
Then Explain each of them....?
Thanks
OriginalGriff 13-Dec-11 4:17am    
If your tutor has set you a question on file systems, then I suspect it will be rather more specific that "explain teh file system in c#" - try reading the question again, it may ask for less general info.
phanny 2011 13-Dec-11 4:21am    
He just focus on reading, creating or moving file or directory... So how can I do it?
OriginalGriff 13-Dec-11 4:25am    
Examples
Reading a file:
File.ReadAllText
Create a file:
File.WriteAllText
Move file:
File.Move

Start reading!
FileSystem is class in C# that is used to perform operations on files,folders and Registry.
You can see methods and properties of this class
FileSystem Class
File System and the Registry
FileSystemWatcher
 
Share this answer
 
The FileSystem module contains the procedures that are used to perform file, directory or folder, and system operations. The My feature gives you better productivity and performance in file I/O operations than using the FileSystem
module

C# Example:
C#
FileInfo f = new FileInfo("file path");
string fname = f.FullName;
string fext = f.Extension;
 
Share this answer
 
v2
file is the concept used to share,read and write etc from one directory are files.


an example for file concept:

Dim MyAttr As FileAttribute
' Assume file TESTFILE is normal and readonly.
MyAttr = GetAttr("C:\TESTFILE.txt") ' Returns vbNormal.

' Test for normal.
If (MyAttr And FileAttribute.Normal) = FileAttribute.Normal Then
MsgBox("This file is normal.")
End If

' Test for normal and readonly.
Dim normalReadonly As FileAttribute
normalReadonly = FileAttribute.Normal Or FileAttribute.ReadOnly
If (MyAttr And normalReadonly) = normalReadonly Then
MsgBox("This file is normal and readonly.")
End If

' Assume MYDIR is a directory or folder.
MyAttr = GetAttr("C:\MYDIR")
If (MyAttr And FileAttribute.Directory) = FileAttribute.Directory Then
MsgBox("MYDIR is a directory")
End If
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900