Archived
This forum has been archived. Please start a new discussion on GitHub.
C#-Specific Metadata Directives
chang
in Help Center
I try to use BinaryFormatter() or Marshal.StructureToPtr() method to convert an class object or a data structure object into byte array.
Both got errors:
(1) it is not marked as serializable
(2) it cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed
So I added a cs Metadata Directives to the class or struct, but it got errors as well. For example the following is in Ice Document but when I add it to my ice file, does not pass Slice2cs.
["cs:attribute:System.Serializable"]
struct Point {
double x;
double y;
};
Thanks
Both got errors:
(1) it is not marked as serializable
(2) it cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed
So I added a cs Metadata Directives to the class or struct, but it got errors as well. For example the following is in Ice Document but when I add it to my ice file, does not pass Slice2cs.
["cs:attribute:System.Serializable"]
struct Point {
double x;
double y;
};
Thanks
0
Comments
-
chang wrote: »
["cs:attribute:System.Serializable"]
struct Point {
double x;
double y;
};
That should work, what is the error reported by slice2cs?0
