That little gem made the class easy to build and it was off to the races after that.
Example:
Imports System.Collections.Generic
'''
''' this is a generic class that can be used to contain properties for an object.
''' The class supports serialization. The class has before and current values and can tell if the vales are different.
'''
'''
'''
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True), _
System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)> _
Public Class Generic_Property(Of T)
Private _B As T = Nothing
Private _V As T = Nothing
end class
notes: the objects inside the class get the type of 'T' and all references to the objects properties etc... use 'T' also.
example:
Public Property CV() As T
Get
Return _V
End Get
Set(ByVal value As T)
_V = value
End Set
End Property
notes: this example is serializable so it can be converted to xml and stored where ever. The values then convert back from xml to the class without any issue. It looks like all of the attributes for making the object serializable to xml are not displayed. If anyone needs help post a comment and I'll try to get you the code.
have fun.
~Lost
No comments:
Post a Comment