The Serializable attribute cannot be applied to a struct since all value
types (including structs) are automatically serializable.
Ken
How about:
public struct ABC {
public Hashtable myHashtable;
}
There's a perfectly valid struct. How's it going to serialise tha Hashtable?
And you can apply the attribute to it.
Simon Smith
simon dot s at ghytred dot com
www.ghytred.com/NewsLook - NNTP Client for Outlook
Ben Terry said:
I get the following compilation error:
"The type or namespace name 'Serializable' could not be found (are you
missing a using directive or an assembly reference?)"
Can anyone tell me why the following code will not compile? I thought the
"Serializable" attribute was located in the System.Runtime.Serialization
assembly. I'm trying to stream this structure to/from a byte array.
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace PetToolTCPLib
{
[Serializable]
public struct MIX_CompleteIllumStateMsg
{
public MIX_MISC_ENUMS som; // start of message sentinel always set
to 0xC0DEF00D
public uint length; // total message length in bytes
public MIX_MessageId msgId; // message id
public MESSAGE_LOG_HEADER_STRUCT theHeader;
public MESSAGE_LOG_RUN_PERIODIC_STRUCT theRealTimeInfo;
}
}