Visual Basic (Declaration) | |
---|---|
Public Overridable Sub Deserialize( _ ByVal instance As Object, _ ByVal rawstorage As INameValueStore _ ) |
C# | |
---|---|
public virtual void Deserialize( object instance, INameValueStore rawstorage ) |
Parameters
- instance
- rawstorage
Library/Library.Test/TestPropertySerializer.cs
C# | Copy Code |
---|---|
PropertySerializer ser = new PropertySerializer(typeof(TestValues1), ValueNames); ser.ContinueOnError = false; Assert.AreEqual(false, ser.ContinueOnError); ser.Serialize(ValuesA, Dictionary); TestValues test = new TestValues(); ser.Deserialize(test, Dictionary); Assert.AreEqual(ValuesA._bool, test._bool); Assert.AreEqual(ValuesA._byte, test._byte); Assert.AreEqual(ValuesA._char, test._char); Assert.AreEqual(ValuesA._DateTime, test._DateTime); Assert.AreEqual(ValuesA._decimal, test._decimal); Assert.AreEqual(ValuesA._double, test._double); Assert.AreEqual(ValuesA._float, test._float); Assert.AreEqual(ValuesA._Guid, test._Guid); Assert.AreEqual(ValuesA._int, test._int); Assert.AreEqual(ValuesA._long, test._long); Assert.AreEqual(ValuesA._sbyte, test._sbyte); Assert.AreEqual(ValuesA._short, test._short); Assert.AreEqual(ValuesA._string, test._string); Assert.AreEqual(ValuesA._TimeSpan, test._TimeSpan); Assert.AreEqual(ValuesA._uint, test._uint); Assert.AreEqual(ValuesA._ulong, test._ulong); Assert.AreEqual(ValuesA._Uri, test._Uri); Assert.AreEqual(ValuesA._ushort, test._ushort); Assert.AreEqual(ValuesA._Version, test._Version); //ROK - note, it can not deserialize this since it does not know the type: Assert.AreEqual(null, test._object); |
VB.NET | Copy Code |
---|---|
Dim ser As New PropertySerializer(GetType(TestValues1), ValueNames) ser.ContinueOnError = False Assert.AreEqual(False, ser.ContinueOnError) ser.Serialize(ValuesA, Dictionary) Dim test As New TestValues() ser.Deserialize(test, Dictionary) Assert.AreEqual(ValuesA._bool, test._bool) Assert.AreEqual(ValuesA._byte, test._byte) Assert.AreEqual(ValuesA._char, test._char) Assert.AreEqual(ValuesA._DateTime, test._DateTime) Assert.AreEqual(ValuesA._decimal, test._decimal) Assert.AreEqual(ValuesA._double, test._double) Assert.AreEqual(ValuesA._float, test._float) Assert.AreEqual(ValuesA._Guid, test._Guid) Assert.AreEqual(ValuesA._int, test._int) Assert.AreEqual(ValuesA._long, test._long) Assert.AreEqual(ValuesA._sbyte, test._sbyte) Assert.AreEqual(ValuesA._short, test._short) Assert.AreEqual(ValuesA._string, test._string) Assert.AreEqual(ValuesA._TimeSpan, test._TimeSpan) Assert.AreEqual(ValuesA._uint, test._uint) Assert.AreEqual(ValuesA._ulong, test._ulong) Assert.AreEqual(ValuesA._Uri, test._Uri) Assert.AreEqual(ValuesA._ushort, test._ushort) Assert.AreEqual(ValuesA._Version, test._Version) 'ROK - note, it can not deserialize this since it does not know the type: Assert.AreEqual(Nothing, test._object) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7