Hi,
No, that will not work. The underlying Type is required, and if the
formatter cannot find it then it will fail.
An interface requires an implementation and so cannot be constructed - it's
the concrete type that must be constructed. The full type name of the
concrete implementation that was serialized is stored in the serialized
object graph and the formatter will attempt to use this information to load
the Type meta data at runtime. Obviously, if your assembly is not
referencing the type's assembly, then the formatter will not be able to
resolve the Type and the operation will fail.
--
Dave Sexton
http://davesexton.com/blog
"TheMadHatter" <Th**********@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
>
oop Q:
If I serialize an interface array, then later deserialize it, do I need
the
original
assembly to deserialize it???
Eg:
// Inside of "globaly assembly"
public interface Ianimal
{
string myColor
{ get;}
}
// "Dog Assembly" Inside of dynamicaly loaded assembly.
// Knows only "global Assembly"
public class dog: Ianimal
{
string myColor
{
get{return "black";}
}
}
// my main Assembly where the "magic" happens.
//Initialy only knows the "global assembly"
pubilc class myMainClass
{
Type AnimalType;
void DynamiclyLoadAssembly(string assemblyFileName)
{ //ommitted,but this is where AnimalType is defined}
private Ianimal[] myAnimals;
void SomeFunction(int x)
{
Ianimal[x] = (Ianimal) (new AnimalType());
}
private SerializeAnimals(Ianimals[] myAnimals )
{//ommitted}
private DeserializeMyAnimals()
{
//Q: If the next time I run the app, and I dont load the "Dog
Assembly",
// will this fail?????????????????????????????
}
}
Thanks in advance.