ISyncFilterDeserializer.Deserialize Method
When overridden in a derived class, creates an ISyncFilter object and initializes it by using serialized data.
Namespace: Microsoft.Synchronization
Assembly: Microsoft.Synchronization (in microsoft.synchronization.dll)
Syntax
'Declaration
Function Deserialize ( _
data As Byte() _
) As ISyncFilter
'Usage
Dim instance As ISyncFilterDeserializer
Dim data As Byte()
Dim returnValue As ISyncFilter
returnValue = instance.Deserialize(data)
ISyncFilter Deserialize (
byte[] data
)
ISyncFilter^ Deserialize (
array<unsigned char>^ data
)
ISyncFilter Deserialize (
byte[] data
)
function Deserialize (
data : byte[]
) : ISyncFilter
Parameters
- data
The serialized filter data.
Return Value
The newly created ISyncFilter object that is initialized by using the serialized data that is contained in data.
Remarks
This method deserializes data that is produced by the Serialize method for the associated custom filter.
Example
The following example uses a BinaryReader object to deserialize the custom filter from a byte array.
Public Function Deserialize(ByVal data As Byte()) As ISyncFilter Implements ISyncFilterDeserializer.Deserialize
Dim memStream As New MemoryStream(data, 0, data.Length, False, True)
Dim biReader As New BinaryReader(memStream, Encoding.Unicode)
DeserializeFromBinaryReader(biReader, memStream)
Return Me
End Function
Private Sub DeserializeFromBinaryReader(ByVal biReader As BinaryReader, ByVal memStream As MemoryStream)
Dim hasFilterForgottenKnowledge As Boolean = biReader.ReadBoolean()
_filter = biReader.ReadString()
If hasFilterForgottenKnowledge Then
Dim cbForgottenKnowledge As Integer = biReader.ReadInt32()
Dim rawBuffer As Byte() = biReader.ReadBytes(cbForgottenKnowledge)
_filterForgottenKnowledge = ForgottenKnowledge.Deserialize(ContactStore.ContactIdFormatGroup, rawBuffer)
End If
End Sub
public ISyncFilter Deserialize(byte[] data)
{
MemoryStream memStream = new MemoryStream(data, 0, data.Length, false, true);
BinaryReader biReader = new BinaryReader(memStream, Encoding.Unicode);
DeserializeFromBinaryReader(biReader, memStream);
return this;
}
private void DeserializeFromBinaryReader(BinaryReader biReader, MemoryStream memStream)
{
bool hasFilterForgottenKnowledge = biReader.ReadBoolean();
_filter = biReader.ReadString();
if (hasFilterForgottenKnowledge)
{
int cbForgottenKnowledge = biReader.ReadInt32();
byte[] rawBuffer = biReader.ReadBytes(cbForgottenKnowledge);
_filterForgottenKnowledge = ForgottenKnowledge.Deserialize(ContactStore.ContactIdFormatGroup,
rawBuffer);
}
}
See Also
Reference
ISyncFilterDeserializer Interface
ISyncFilterDeserializer Members
Microsoft.Synchronization Namespace