TAILIEUCHUNG - Network Programming in .NET With C# and Visual Basic .NET phần 2

Mỗi phản ứng HTTP có một mã phản hồi. Trong ví dụ trên, các mã phản hồi là 200. Con số này được theo sau bởi một số văn bản của con người có thể đọc được (tức là, OK). Các mã phản hồi rơi vào năm loại chính thể hiện trong Bảng . | Streams 37 _purchaseOrderStatus _invoiceDate end if end sub End Class Note The use of the Serializable tag facilitates deep seilalization. It is possible to perform deep serialization without this tag by using surrogates. A surrogate is where the a class implements ISerializationSurrogate and is passed to the AddSurrogate method of a SurrogateSelector object. The SurrogateSelector property of the formatter is then set equal to this object prior to serialization. The _purchaseOrderStatus variable is private and can only be modified by recordDelivery recordInvoice and recordPayment . This ensures that a bug elsewhere in the code will not cause undelivered goods to be paid for . _purchaseOrderStatus cannot change directly from ISSUED to paid . Similarly the date recording is encapsulated within the object and cannot be externally manipulated. To place a purchase order on a stream either to disk or to the network you could write each value one after the other as text separated by commas and have the receiver parse out the values and re-create the object however there is an easier way serialization. To write the object to a stream and save the object to disk you could use the following code C private void button1_Click object sender e company Vendor new company company Buyer new company lineitem Goods new lineItem purchaseOrder po new purchaseOrder Acme Inc. Wiley E. Coyote anti-RoadRunner cannon 1 I Chapter 2 38 Streams new lineItem 1 0 Goods Buyer Vendor SoapFormatter sf new SoapFormatter FileStream fs C fs po Private Sub Button1_Click ByVal sender As Object ByVal e As _ Handles Dim Vendor As company New company Dim Buyer As company New .

TỪ KHÓA LIÊN QUAN
Đã 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.