Re: Serialization and inheritance
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 16 Nov 2005 12:13:36 -0500
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.
>
.
- Follow-Ups:
- Re: Serialization and inheritance
- From: Gerben
- Re: Serialization and inheritance
- References:
- Serialization and inheritance
- From: Gerben
- Serialization and inheritance
- Prev by Date: Re: System.Web.Mail.MailMessage.From property assignment problem
- Next by Date: Strongly typed resources
- Previous by thread: Serialization and inheritance
- Next by thread: Re: Serialization and inheritance
- Index(es):
Relevant Pages
|