SerializerSelector Class
Namespace: Stride.Core.SerializationAssembly: Stride.Core.dll
Serializer context. It holds DataSerializer{T} objects and their factories.
public class SerializerSelector
| Name | Description | |
|---|---|---|
| Constructors | ||
| SerializerSelector(Boolean, Boolean, String[]) | Initializes a new instance of the SerializerSelector class. |
|
| SerializerSelector(String[]) | ||
| Fields | ||
| SelectorOverride | ||
| Properties | ||
| Asset | ||
| AssetWithReuse | ||
| Default | Gets the default instance of Serializer. |
|
| ExternalIdentifiableAsGuid | Gets whether IIdentifiable instances marked as external will have only their System.Guid stored. |
|
| Profiles | ||
| ReuseReferences | Gets whether serialization reuses references, where each reference gets assigned an ID and if it is serialized again, same instance will be reused). |
|
| SerializerFactories | ||
| Methods | ||
| EnsureInitialized(DataSerializer) | Internal function, for use by SerializerFactory. |
|
| GetSerializer(ref ObjectId) | ||
| GetSerializer(Type) | Gets the serializer. |
|
| GetSerializer<T>() | Gets the serializer. |
|
| HasProfile(String) | Checks if this instance supports the specified serialization profile. |
|
Constructors
SerializerSelector(Boolean, Boolean, String[])
Initializes a new instance of the SerializerSelector class.
public SerializerSelector(bool reuseReferences, bool externalIdentifiableAsGuid, params string[] profiles)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | reuseReferences | if set to |
| System.Boolean | externalIdentifiableAsGuid | |
| System.String[] | profiles | The profiles. |
SerializerSelector(String[])
public SerializerSelector(params string[] profiles)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | profiles |
Fields
SelectorOverride
public SerializerSelector SelectorOverride
Field Value
| Type | Description |
|---|---|
| SerializerSelector |
Properties
Asset
public static SerializerSelector Asset { get; }
Property Value
| Type | Description |
|---|---|
| SerializerSelector |
AssetWithReuse
public static SerializerSelector AssetWithReuse { get; }
Property Value
| Type | Description |
|---|---|
| SerializerSelector |
Default
Gets the default instance of Serializer.
public static SerializerSelector Default { get; }
Property Value
| Type | Description |
|---|---|
| SerializerSelector | The default instance. |
ExternalIdentifiableAsGuid
Gets whether IIdentifiable instances marked as external will have only their System.Guid stored.
public bool ExternalIdentifiableAsGuid { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Profiles
public IEnumerable<string> Profiles { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.String> |
ReuseReferences
Gets whether serialization reuses references, where each reference gets assigned an ID and if it is serialized again, same instance will be reused).
public bool ReuseReferences { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
SerializerFactories
public List<SerializerFactory> SerializerFactories { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<SerializerFactory> |
Methods
EnsureInitialized(DataSerializer)
Internal function, for use by SerializerFactory.
public void EnsureInitialized(DataSerializer dataSerializer)
Parameters
| Type | Name | Description |
|---|---|---|
| DataSerializer | dataSerializer | The data serializer to initialize if not done yet |
GetSerializer(ref ObjectId)
public DataSerializer GetSerializer(ref ObjectId typeId)
Parameters
| Type | Name | Description |
|---|---|---|
| ObjectId | typeId |
Returns
| Type | Description |
|---|---|
| DataSerializer |
GetSerializer(Type)
Gets the serializer.
public DataSerializer GetSerializer(Type type)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Type | type | The type that you want to (de)serialize. |
Returns
| Type | Description |
|---|---|
| DataSerializer | The DataSerializer<T> for this type if it exists or can be created, otherwise null. |
GetSerializer<T>()
Gets the serializer.
public DataSerializer<T> GetSerializer<T>()
Returns
| Type | Description |
|---|---|
| DataSerializer<T> | The DataSerializer<T> for this type if it exists or can be created, otherwise null. |
Type Parameters
| Name | Description |
|---|---|
| T | The type that you want to (de)serialize. |
HasProfile(String)
Checks if this instance supports the specified serialization profile.
public bool HasProfile(string profile)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | profile | Name of the profile |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|