Metalama 1.0 / / Metalama Documentation / Aspect API / Metalama.​Framework.​Serialization / ICompile­Time­Serializable

Interface ICompileTimeSerializable

Marks the implementing type as being serializable. Aspects and fabrics are typically serialized when they affect a different project than the current one (by inheritance or reference validation). Serialized objects may be deserialized on a different machine than the one on which they have been serialized, and a long time after.

Namespace: Metalama.Framework.Serialization
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface ICompileTimeSerializable
Remarks

When a type is marked as lama-serializable, all fields and automatic properties should be of a serializable type, except those annotated with the NonCompileTimeSerializedAttribute custom attribute.

The following system types are serializable: intrinsic types, arrays of serializable types, DateTime, TimeSpan, CultureInfo, Guid, Dictionary<TKey,TValue>, List<T>, ImmutableArray<T>, ImmutableDictionary<TKey,TValue>.

To serialize another system type, implement a ReferenceTypeSerializer or ValueTypeSerializer<T> and register it by adding a ImportSerializerAttribute custom attribute to the types that uses it.

To serialize an IDeclaration, use the ToRef() method and store the IRef<T>.