![Phân tích tư tưởng của nhân dân qua đoạn thơ: Những người vợ nhớ chồng… Những cuộc đời đã hóa sông núi ta trong Đất nước của Nguyễn Khoa Điềm](https://timtailieu.net/upload/document/136415/phan-tich-tu-tuong-cua-nhan-dan-qua-doan-tho-039-039-nhung-nguoi-vo-nho-chong-nhung-cuoc-doi-da-hoa-song-nui-ta-039-039-trong-dat-nuoc-cua-nguyen-khoa-136415.jpg)
C# and .NET FrameworkBài 8: File and RegistryĐoàn Quang Minh minhdqtt@gmail.com
Số trang: 15
Loại file: pdf
Dung lượng: 217.67 KB
Lượt xem: 9
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
C# and .NET FrameworkBài 8: File and RegistryĐoàn Quang Minh minhdqtt@gmail.com http://www.VTPortal.net Last update: 30. December 2006File and Registry - Editor: Đoàn Quang Editor: Đoà Minh1Mục lụcManaging the File System Moving, Copying, and Deleting Files Reading and Writing to Files The Registry Ứng dụngFile and Registry - Editor: Đoàn Quang Editor: Đoà Minh2Managing the File System.NET hỗ trợ các thao tác làm việc với file– Các tác vụ thông thường như liệt kê file, sao chép, di chuyển, xoá. – Các lớp thao tác với file nằm trong namespace System.IO – Các lớp quan trọng: File, FileInfo, Directory, Path,...Làm việc...
Nội dung trích xuất từ tài liệu:
C# and .NET FrameworkBài 8: File and RegistryĐoàn Quang Minh minhdqtt@gmail.comC# and .NET Framework Bài 8: File and Registry 8: File Đoàn Quang Minh minhdqtt@gmail.com http://www.VTPortal.net Last update: 30. December 2006 Last 30. File and Registry - Editor: Đoàn Quang Editor: oà File 1 Minh Mục lụcManaging the File SystemMoving, Copying, and Deleting FilesReading and Writing to FilesThe RegistryỨng dụng File and Registry - Editor: Đoàn Quang Editor: oà File 2 Minh Managing the File System.NET hỗ trợ các thao tác làm việc với file– Các tác vụ thông thường như liệt kê file, sao chép, di chuyển, xoá.– Các lớp thao tác với file nằm trong namespace System.IO– Các lớp quan trọng: File, FileInfo, Directory, Path,...Làm việc với file và folder– Có 2 loại đối tượng làm việc với file và folder lo Directory và File: chỉ chứa các phương thức tĩnh, không thể khởi Directory File: ch tạo. Thường dùng khi chỉ thực hiện 1 thao tác với 1 file hoặc folder. Khi thao tác, chỉ cần cung cấp đường dẫn đến file hay folder cần làm việc DirectoryInfo và FileInfo: cung cấp các phương thức như 2 đối cung tượng trên, nhưng yêu cầu phải tạo instance. Thường dùng khi thực hiện nhiều thao tác với 1 file hoặc folder. File and Registry - Editor: Đoàn Quang Editor: oà File 3 Minh Managing the File System Tên Ý nghĩaCreationTime Thời gian tạo file hoặc folderDirectoryName (FileInfo), Đường dẫn đầy đủ của folder chứa file hoặc folder hiện thờiParent (DirectoryInfo)Exists File hay folder có tồn tại hay không?Extension Phần mở rộngFullName Tên đầy đủ, cả đường dẫnLastAccessTime Thời gian lần truy cập cuốiLastWriteTime Thời gian lần sửa đổi cuốiName Tên file hay folderRoot Folder gốc (chỉ với DirectoryInfo)Length Dung lượng (bytes), chỉ với FileInfo File and Registry - Editor: Đoàn Quang Editor: oà File 4 Minh Managing the File System// khởi tạo biến myFile trỏ đến một tập tin// khFileInfo myFile = new FileInfo(@C:How to C Sharp.txt); new FileInfo(@C How Sharp.txt// sao chép sang ổ đĩa D// sao sangmyFile.CopyTo(@D:);// kiiểm tra sự tồn tại// kConsole.WriteLine(myFile.Exists.ToString());// ghi thông tin thời điểm tạo file// ghi tin thConsole.WriteLine(myFile.CreationTime.ToString());// cập nhật thời điểm tạo file//myFile.CreationTime = new DateTime(2001, 1, 1, 7, 30, 0); File and Registry - Editor: Đoàn Quang Editor: oà File 5 Minh Managing the File SystemDirectoryInfo theFolder = new DirectoryInfo(folderFullName); new DirectoryInfo(folderFullNameif (!theFolder.Exists) throw new DirectoryNotFoundException(Folder not found: + throw DirectoryNotFoundException(Folder not folderFullName); folderFullNamestring currentPath = theFolder.FullName;string currentPath theFolder.FullName// Lấy tên các thư mục con của thư mục hiện thời//ArrayList folders = new ArrayList(); folders ArrayListforeach(DirectoryInfo folder in theFolder.GetDirectories()) folder theFolder.GetDirectories folders.Add(folder.Name);// Lấy tên các file trong thư mục hiện thời//ArrayList files = new ArrayList(); files ArrayListforeach(FileInfo file in theFolder.GetFiles()) file theFolder.GetFiles files.Add(file.Name); File and Registry - Editor: Đoàn Quang Editor: oà File 6 MinhMoving, Copy ...
Nội dung trích xuất từ tài liệu:
C# and .NET FrameworkBài 8: File and RegistryĐoàn Quang Minh minhdqtt@gmail.comC# and .NET Framework Bài 8: File and Registry 8: File Đoàn Quang Minh minhdqtt@gmail.com http://www.VTPortal.net Last update: 30. December 2006 Last 30. File and Registry - Editor: Đoàn Quang Editor: oà File 1 Minh Mục lụcManaging the File SystemMoving, Copying, and Deleting FilesReading and Writing to FilesThe RegistryỨng dụng File and Registry - Editor: Đoàn Quang Editor: oà File 2 Minh Managing the File System.NET hỗ trợ các thao tác làm việc với file– Các tác vụ thông thường như liệt kê file, sao chép, di chuyển, xoá.– Các lớp thao tác với file nằm trong namespace System.IO– Các lớp quan trọng: File, FileInfo, Directory, Path,...Làm việc với file và folder– Có 2 loại đối tượng làm việc với file và folder lo Directory và File: chỉ chứa các phương thức tĩnh, không thể khởi Directory File: ch tạo. Thường dùng khi chỉ thực hiện 1 thao tác với 1 file hoặc folder. Khi thao tác, chỉ cần cung cấp đường dẫn đến file hay folder cần làm việc DirectoryInfo và FileInfo: cung cấp các phương thức như 2 đối cung tượng trên, nhưng yêu cầu phải tạo instance. Thường dùng khi thực hiện nhiều thao tác với 1 file hoặc folder. File and Registry - Editor: Đoàn Quang Editor: oà File 3 Minh Managing the File System Tên Ý nghĩaCreationTime Thời gian tạo file hoặc folderDirectoryName (FileInfo), Đường dẫn đầy đủ của folder chứa file hoặc folder hiện thờiParent (DirectoryInfo)Exists File hay folder có tồn tại hay không?Extension Phần mở rộngFullName Tên đầy đủ, cả đường dẫnLastAccessTime Thời gian lần truy cập cuốiLastWriteTime Thời gian lần sửa đổi cuốiName Tên file hay folderRoot Folder gốc (chỉ với DirectoryInfo)Length Dung lượng (bytes), chỉ với FileInfo File and Registry - Editor: Đoàn Quang Editor: oà File 4 Minh Managing the File System// khởi tạo biến myFile trỏ đến một tập tin// khFileInfo myFile = new FileInfo(@C:How to C Sharp.txt); new FileInfo(@C How Sharp.txt// sao chép sang ổ đĩa D// sao sangmyFile.CopyTo(@D:);// kiiểm tra sự tồn tại// kConsole.WriteLine(myFile.Exists.ToString());// ghi thông tin thời điểm tạo file// ghi tin thConsole.WriteLine(myFile.CreationTime.ToString());// cập nhật thời điểm tạo file//myFile.CreationTime = new DateTime(2001, 1, 1, 7, 30, 0); File and Registry - Editor: Đoàn Quang Editor: oà File 5 Minh Managing the File SystemDirectoryInfo theFolder = new DirectoryInfo(folderFullName); new DirectoryInfo(folderFullNameif (!theFolder.Exists) throw new DirectoryNotFoundException(Folder not found: + throw DirectoryNotFoundException(Folder not folderFullName); folderFullNamestring currentPath = theFolder.FullName;string currentPath theFolder.FullName// Lấy tên các thư mục con của thư mục hiện thời//ArrayList folders = new ArrayList(); folders ArrayListforeach(DirectoryInfo folder in theFolder.GetDirectories()) folder theFolder.GetDirectories folders.Add(folder.Name);// Lấy tên các file trong thư mục hiện thời//ArrayList files = new ArrayList(); files ArrayListforeach(FileInfo file in theFolder.GetFiles()) file theFolder.GetFiles files.Add(file.Name); File and Registry - Editor: Đoàn Quang Editor: oà File 6 MinhMoving, Copy ...
Tìm kiếm theo từ khóa liên quan:
tài liệu công nghệ thông tin thủ thuật máy tính kinh nghiệm máy tính hướng dẫn học công nghệ thông tin mẹo công nghệ thông tinTài liệu liên quan:
-
Top 10 mẹo 'đơn giản nhưng hữu ích' trong nhiếp ảnh
11 trang 325 0 0 -
Làm việc với Read Only Domain Controllers
20 trang 318 0 0 -
Sửa lỗi các chức năng quan trọng của Win với ReEnable 2.0 Portable Edition
5 trang 224 0 0 -
Phần III: Xử lý sự cố Màn hình xanh
3 trang 218 0 0 -
Tổng hợp 30 lỗi thương gặp cho những bạn mới sử dụng máy tính
9 trang 211 0 0 -
Giáo trình Bảo trì hệ thống và cài đặt phần mềm
68 trang 209 0 0 -
Sao lưu dữ liệu Gmail sử dụng chế độ Offline
8 trang 209 0 0 -
UltraISO chương trình ghi đĩa, tạo ổ đĩa ảo nhỏ gọn
10 trang 204 0 0 -
Hướng dẫn cách khắc phục lỗi màn hình xanh trong windows
7 trang 203 0 0 -
Giáo Trình tin học căn bản - ĐH Marketing
166 trang 199 0 0