TAILIEUCHUNG - Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition phần 6

Hai phương pháp cuối cùng của sự quan tâm vào thời điểm này là CreateText () và AppendText (), cả hai đều trở về một tham chiếu StreamWriter, như được hiển thị ở đây Khi bạn đang sử dụng một bộ chuyển đổi dữ liệu để sửa đổi các bảng trong một DataSet, thứ tự đầu tiên của kinh doanh là giao UpdateCommand, DeleteCommand, | Simpo PDF Merge and Split Unregistered Version - http 672 CHAPTER 20 FILE I O AND ISOLATED STORAGE FileInfo f3 new FileInfo @ C using FileStream readOnlyStream Use the Filestream object. Now get a Filestream object with write-only permissions. FileInfO f4 new FileInfo @ C using FileStream writeOnlyStream . Use the Filestream object. The Method Another open-centric member of the FileInfo type is OpenText . Unlike Create Open OpenRead and OpenWrite the OpenText method returns an instance of the StreamReader type rather than a FileStream type. Assuming you have a file named on your C drive the following would be one manner to gain access to its contents static void Main string args L zzz z Get a streamReader object. FileInfo f5 new FileInfo @ C using StreamReader sreader . Use the streamReader object. As you will see shortly the StreamReader type provides a way to read character data from the underlying file. The and Methods The final two methods of interest at this point are CreateText and AppendText both of which return a StreamWriter reference as shown here static void Main string args _ FileInfo f6 new FileInfo @ C using StreamWriter swriter . Use the streamWriter object. FileInfo f7 new FileInfo @ C using StreamWriter swriterAppend . Use the streamWriter object. As you would guess the StreamWriter type provides a way to write character data to the underlying file. Simpo PDF Merge and Split Unregistered Version - http CHAPTER 20 FILE I O AND ISOLATED STORAGE 673 Working with the File Type The File type provides functionality almost identical to that of the FileInfo type using a number of static members. Like FileInfo File supplies AppendText Create CreateText Open OpenRead OpenWrite and OpenText methods. In fact in many cases the File and FileInfo .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.