.net - Why is this type not serializable? -


After

I try to determine why this type is not tested by serializable (as Type.IsSerializable () )

  & lt; SerialJable () & gt; _Local MustInherit Class WellKnownInstanceCollectionWithTypedId (WellKnownInstanceWithTypedId of T (IDT), inherited ReadOnlyCollection (T) Public Sub-New (ByVal list as IList (TK)) MyBase.New (List) End Sub Public Function GetById (ByVal ID IDT) as the T-Measure Me.FirstOrDefault (Function Item) Item.Id.Equals (ID) Expiration Function End Class  

I know That's something for me with GetById function, because if I'm going to fix that everything, I can tell that I need to change to be serializable like this

Update:

When I get my GetById Implementation in this way, everything is fine. Obviously this is something with Linq (as suggested below) - Anybody can give me more information on why this is so much

  for public benefit GetById each (ByVal As ID IDT) i return i.Id.Equals (i) in my T. then return I end then the next return anything end function  

This can be related to the Lambda expression ( function ) in GetById . Call it to call a AddressOf . See that making VB.NET for you to close the background is happening in the way of serialization.

(Prompt comment to answer)
In your entire code, to check whether is < / Em> LINQ to turn off, just change your original code to return me. FirstOver Default (Inaccurate)

I believe that it has to be serial again if it is so, then you function (item) instead of AddressOf id.Equals ... , unless you have a zero ( id not )


Comments