Đang chuẩn bị liên kết để tải về tài liệu:
Foundations of F#.Net phần 8
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'foundations of f#.net phần 8', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 212 CHAPTER 9 DATA ACCESS system.data windows system.webServer mscorlib system.data.oledb system.data.oracleclient system.data.sqlclient configProtectedData satelliteassemblies system.data.dataset startup system.data.odbc system.diagnostics runtime system.codedom system.runtime.remoting connectionStrings assemblyBinding appSettings system.windows.forms This section has shown how to work with configuration files a particular kind of XML file. The next section will show how to use the System.Xml namespace to work with any kind of XML file. The System.IO Namespace The main purpose of the System.IO namespace is to provide types that give easy access to the files and directories of the operating system s file store although it also provides ways of writing to memory and network streams too. The namespace offers two main ways to deal with files and directories. FileInfo and DirectoryInfo objects are used to get or alter information about a file or directory. There are also File and Directory classes that offer the same functionality but that are exposed as static members that require the filename to be passed to each method. Generally you will use the File and Directory classes if you want a single piece of information about a file system object and use the FileInfo and DirectoryInfo classes if you need lots of information about a single file system object. The two techniques are complementary for example you might use the Directory type to get information about all the files in a directory and then use the FileInfo object to find out the name and other information about the file. Here s an example of doing this light open System.IO let files Directory.GetFiles @ c CHAPTER 9 DATA ACCESS 213 for filepath in files do let file new FileInfo filepath printfn s t d t O file.Name file.Length file.CreationTime The results when executed on my machine are as follows addadmin.bat 95 01 10 2003 02 08 10 ATTDialer.doc 297472 03 11 2003 20 12 54 AUTOEXEC.BAT 0 12 05 2003 20 21 21 .