Đang chuẩn bị liên kết để tải về tài liệu:
Professional ASP.NET 3.5 in C# and Visual Basic Part 122
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Professional ASP.NET 3.5 in C# and Visual Basic Part 122. Building on the revolutionary ASP.NET 2.0 release, ASP.NET 3.5 adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in ASP.NET 2.0 now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 25 File I O and Streams Filestream resources as Close does it can be very useful if you are going to perform multiple write operations and do not want to release and then reacquire the resources for each write operation. As you can see so far reading and writing to files is really quite easy. The good thing is that as mentioned earlier because .NET uses the same basic stream model for a variety of data stores you can use these same techniques for reading and writing to any of the stream derived classes. Listing 25-15 shows how you can use the same basic code to write to a Memorystream and Listing 25-16 demonstrates reading a Telnet server response using the Networkstream. Listing 25-15 Writing to a MemoryStream VB Dim data As Byte system.Text.Encoding.AsCII.GetBytes This is a string Dim ms As New system.IO.Memorystream ms.Write data 0 data.Length ms.Close C byte data system.Text.Encoding.AsciI.GetBytes This is a string system.IO.Memorystream ms new system.IO.Memorystream ms.Write data 0 data.Length ms.Close Listing 25-16 Reading from a NetworkStream VB Dim client As New system.Net.sockets.TcpClient Note You can find a large list of Telnet accessible BBs systems at http www.dmine.com telnet brieflist.htm The WCs Online BBs http bbs.wcssoft.com Dim addr As system.Net.IPAddress system.Net.IPAddress.Parse 65.182.234.52 Dim endpoint As New system.Net.IPEndPoint addr 23 client.Connect endpoint Dim ns As system.Net.sockets.Networkstream client.Getstream If ns.DataAvailable Then Dim data client.ReceiveBuffersize As Byte ns.Read data 0 client.ReceiveBuffersize Dim response As string system.Text.Encoding.AsciI.Getstring data End If ns.Close C system.Net.sockets.TcpClient client new system.Net.sockets.TcpClient Note You can find a large list of Telnet accessible BBs systems at http www.dmine.com telnet brieflist.htm The WCs Online BBs http bbs.wcssoft.com system.Net.IPAddress addr system.Net.IPAddress.Parse 65.182.234.52 system.Net.IPEndPoint endpoint new .