The aim is to allow the programmer to write a .NET class (or struct) containing fields (or properties) as meta-data, to be interpreted by run-time code.
So the programmer would write:
class foo {
int x;
string y;
double z;
}
Then the run-time code would use this as instructions to deserialise a stream (one field at a time) and fill an instance of the class.
The actual layout of the class is unimportant, so SequentialLayoutAttribute is no help. It's the order in which the fields were declared that matters, and Reflection rather helpfully points out that members are retrieved in no particular order.
Aucun commentaire:
Enregistrer un commentaire