使用<Serializable()> 之后无法引用其属性与方法
新学VB.NET 看到一个对象克隆例子 实际写完之后却发现无法进行属性引用代码如下:
Cresume类
Imports System.IO
Imports System.Runtime.Serialization.Formatter
<Serializable()> Public Class Cresume
'姓名
Dim m_Name As String
'地址
Dim m_Address As String
Public Property Address() As String
Get
Return m_Address
End Get
Set(ByVal value As String)
m_Address = value
End Set
End Property
Public Property Name() As String
Get
Return m_Name
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Function Clone() As Cresume
Dim MS As New MemoryStream()
Dim BF As New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter()
BF.Serialize(MS, Me)
MS.Position = 0
Return (CType(BF.Deserialize(MS), Cresume))
End Function
End Class
FORM页面中可以IMPORTS Cresume
之后Dim resume1 As New Cresume() 也不会有错误提示
但是下一步使用实例resume1时候提示错误declaration expected
原帖地址http://developer.51cto.com/art/201001/180081.htm
还望大家帮帮忙指点一二 在此谢过
补充:.NET技术 , VB.NET