正在阅读:.Net进阶:实现Prototype设计模式.Net进阶:实现Prototype设计模式

2004-05-28 10:23 出处:CSDN 作者:guoyan19811021(翻译) 责任编辑:linjixiong



<employee>
<firstname>sanjeev</firstname>
<lastname>bhutt</lastname>
</employee>
<employee>
<firstname>li</firstname>
<lastname>li</lastname>
</employee>
</employee>




       VB.Net 实现


Imports System.Xml

Imports System.IO

Imports System.Collections

Imports System.Runtime.Serialization

Imports System.Runtime.Serialization.Formatters.Binary

<Serializable()> Public Class CEmpData

   Implements ICloneable, ISerializable

    Private ArrEmp As ArrayList

    Public Sub New()

        Dim xmldoc As New XmlDocument

        Dim node As XmlNode

        Dim objEmp As CEmp

        ArrEmp = New ArrayList

        xmldoc.Load("empdata.xml")

        For Each node In xmldoc.DocumentElement.ChildNodes

            objEmp = New CEmp

            objEmp.FName = node.SelectSingleNode("firstname").InnerText

            objEmp.LName = node.SelectSingleNode("lastname").InnerText

            ArrEmp.Add(objEmp)

        Next

    End Sub

    Public Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)

        Dim intIndex As Integer

 


察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:

键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品