Dear All,
Is it possible to make the linq object as serializable. I need to pass the serialized Data as parameter to the Remoting Method.
My LinQ Query is as follows
Dim LinqQuery = From R In dsEdit.Tables(0) _
Where R.Field(Of Integer)("ID") < 400 _
Select R
ZipObject(LinqQuery)
The Definition of ZipObject is as follows.
Public Function ZipObject(ByVal obj As Object) As Byte()
Dim ms As New MemoryStream()
Dim bf As New BinaryFormatter()
Dim ds As DeflateStream = Nothing
Try
ds = New DeflateStream(ms, CompressionMode.Compress)
bf.Serialize(ds, obj)
ds.Flush()
ds.Close()
Return ms.ToArray()
Catch ex As Exception
ds.Flush()
ds.Close()
Throw New Exception("zipObject : " & ex.Message)
Finally
bf = Nothing
ms.Flush()
ms.Close()
End Try
End Function
While Serializing the LInQ Object I am getting the following Error..
zipObject : Type 'System.Data.EnumerableRowCollection`1[[System.Data.DataRow, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' in Assembly 'System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
Can AnyOne Guess What Could be the Reason.
Is It possible to Serialize the linq.
Any Suggestions...
Thanks
Ravi Kumar.