Re: Serialization and inheritance
- From: "Gerben" <plzdonotreply@xxxxxxx>
- Date: Wed, 16 Nov 2005 21:04:40 +0100
That's a pity. Forces me to move my student class to the shared assembly, it
isn't neat, but it works.
Thanks for your fast reply,
Gerben.
"Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:%23jTdGEt6FHA.3760@xxxxxxxxxxxxxxxxxxxxxxx
> Gerben,
>
> Unfortunately, no, you can not. You need to have a reference to the
> assembly that contains the type you are going to serialize so that the
> serialization framework will be able to load the appropriate type/field
> data for serialization.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> "Gerben" <plzdonotreply@xxxxxxx> wrote in message
> news:dlfoav$iv$1@xxxxxxxxxxxxxxxxxxxxxxxxxx
>> Hello,
>>
>> I'm getting an error when I try to serialize a class in my project. Hope
>> someone can help me out:
>>
>> Shared assembly:
>>
>> [Serializable]
>> public abstract class Person
>> {
>> public int PersonData;
>> }
>>
>> Project1
>>
>> [Serializable]
>> public class Student : Person
>> {
>>
>> }
>>
>> Person person1 = new Student();
>>
>> Project2:
>>
>> I like to serialize person1 (using .net remoting) so I can use that
>> object in this project. Project2 only knows the person class, but that is
>> enough since I only need to access PersonData and nothing else. When I
>> try this i'm getting a serializable exception that says that project2
>> cannot find Project1. But I don't want to include project1 or the student
>> class. Is there a way to solve this / can I tell Student to only
>> serialize the Person data in some way?
>>
>> greets,
>>
>> Gerben.
>>
>
>
.
- References:
- Serialization and inheritance
- From: Gerben
- Re: Serialization and inheritance
- From: Nicholas Paldino [.NET/C# MVP]
- Serialization and inheritance
- Prev by Date: Re: ListBoxes
- Next by Date: Re: MSIDL to C#
- Previous by thread: Re: Serialization and inheritance
- Next by thread: Re: Serialization and inheritance
- Index(es):
Relevant Pages
|