Version 2.1.0.0

CustomSerializationPolicy class

Namespace: Sirenix.Serialization
Assembly: Sirenix.Serialization
public class CustomSerializationPolicy : ISerializationPolicy
Helper class for quickly and easily implementing the Sirenix.Serialization.ISerializationPolicy interface.
Inheritance
  • System.Object
  • CustomSerializationPolicy

Constructors

CustomSerializationPolicy(String, Boolean, Func<MemberInfo, Boolean>)
Initializes a new instance of the CustomSerializationPolicy class.
public CustomSerializationPolicy(string id, bool allowNonSerializableTypes, Func<MemberInfo, bool> shouldSerializeFunc)
Parameters
System.String id

The policy ID.

System.Boolean allowNonSerializableTypes

if set to true non serializable types will be allowed.

System.Func<System.Reflection.MemberInfo, System.Boolean> shouldSerializeFunc

The delegate to use for determining whether members should be serialized.

Exceptions
System.ArgumentNullException

The id argument or the shouldSerializeFunc argument was null.

Properties

AllowNonSerializableTypes
Gets a value indicating whether to allow non serializable types. (Types which are not decorated with System.SerializableAttribute.)
public bool AllowNonSerializableTypes { get; }
ID
Gets the identifier of the policy. This can be stored in the serialization metadata, so the policy used to serialize it can be recovered without knowing the policy at runtime. This ID should preferably be unique.
public string ID { get; }

Methods

ShouldSerializeMember(MemberInfo)
Gets a value indicating whether a given System.Reflection.MemberInfo should be serialized or not.
public bool ShouldSerializeMember(MemberInfo member)
Parameters
System.Reflection.MemberInfo member

The member to check.

Returns
System.Boolean

true if the given member should be serialized, otherwise, false.

This website is brand new and built with the Odin 2.1 beta in mind. This means you might discover some features such as attribute expressions that are only available in the beta.

You can download the 2.1 beta from here and read the patch-notes here.