NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

serializable

Marks a class or struct as being serializable.

[serializable]

Applies To

Class and struct declarations.

Remarks

serializable is a single-use attribute. Serializable is an alias for System.Serialization.SerializableAttribute.

The base class library provides serialization services only to classes and structs with the serializable attribute. In the example below, the fact that class SerialExample is marked serializable and has a member of type Serial2 does not automatically confer the serializable attribute to class Serial2.

Within a serializable class or struct, individual fields can be marked nonserialized to prevent them from being serialized.

Example

[serializable]
public class SerialExample {
   int a;
   Serial2 x;
   [nonserialized] int temp; // don't bother to serialize this field
}
[serializable] // have to make this serializable too
public struct Serial2 { 
   string s;
}

See Also

C# Attributes