tailieunhanh - Foundations of F#.Net phần 8
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 windows mscorlib configProtectedData satelliteassemblies startup runtime connectionStrings assemblyBinding appSettings 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 namespace to work with any kind of XML file. The Namespace The main purpose of the 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 let files @ c CHAPTER 9 DATA ACCESS 213 for filepath in files do let file new FileInfo filepath printfn s t d t O The results when executed on my machine are as follows 95 01 10 2003 02 08 10 297472 03 11 2003 20 12 54 0 12 05 2003 20 21 21 .
đang nạp các trang xem trước