From: <hen...@gm...> - 2004-10-26 16:54:08
|
> == Serialization == > - The GetObjectData implementation should (somehow) be able to persist the > fields of the super class (need to stop to think about it carefully) I thougth in use reflection to inspect the fields and retrieve the values, So I'd decided to try this approach and the first results are: - Type.GetFields doesn't work as expected, ex: <snip> ExtendedSerializableClass type = new ExtendedSerializableClass(); BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; FieldInfo[] fields = type.GetType().GetFields( bindingFlags ); Assert.AreEqual(1, fields.Length); <snip> The test below doesn't pass ( fields.Length returns 0 ). The ExtendedSerializableClass extends the MySerializableClass which I added a static string Iah. Anyway, I'll look this with more attention; - Security Issues: " If the requested type is non-public and the caller does not have ReflectionPermission to reflect non-public objects outside the current assembly, this method returns a null reference (Nothing in Visual Basic). " - Microsoft .NET Framework Documentation; Not so exciting... |