Posts
使用XML序列化程式產生器工具加速XML序列化
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim count As Integer = 1 Dim perosn As New Person Dim xs As New XmlSerializer(GetType(Person)) Dim sw As Stopwatch = Stopwatch.StartNew Using ms As New MemoryStream For i As Integer = 0 To count - 1 ms.Seek(0, SeekOrigin.Begin) xs.Serialize(ms, perosn) Next End Using MsgBox("ElapsedMilliseconds: " & sw.ElapsedMilliseconds) End Sub End Class
Public Class Person Private _name As String Public Property Name() As String Get Return _name End Get Set(ByVal value As String) _name = value End Set End Property
read more