Class fsSerializer
Namespace: Ludiq.FullSerializer
Syntax
public class fsSerializer
  Constructors
fsSerializer()
Declaration
public fsSerializer()
  Fields
Config
Configuration options. Also see fsGlobalConfig.
Declaration
public fsConfig Config
  Field Value
| Type | Description | 
|---|---|
| fsConfig | 
Context
A context object that fsConverters can use to customize how they operate.
Declaration
public fsContext Context
  Field Value
| Type | Description | 
|---|---|
| fsContext | 
Methods
AddConverter(fsBaseConverter)
Adds a new converter that can be used to customize how an object is serialized and deserialized.
Declaration
public void AddConverter(fsBaseConverter converter)
  Parameters
| Type | Name | Description | 
|---|---|---|
| fsBaseConverter | converter | 
AddProcessor(fsObjectProcessor)
Add a new processor to the serializer. Multiple processors can run at the same time in the same order they were added in.
Declaration
public void AddProcessor(fsObjectProcessor processor)
  Parameters
| Type | Name | Description | 
|---|---|---|
| fsObjectProcessor | processor | The processor to add.  | 
      
IsReservedKeyword(String)
Returns true if the given key is a special keyword that full serializer uses to add additional metadata on top of the emitted JSON.
Declaration
public static bool IsReservedKeyword(string key)
  Parameters
| Type | Name | Description | 
|---|---|---|
| String | key | 
Returns
| Type | Description | 
|---|---|
| Boolean | 
RemoveProcessor<TProcessor>()
Remove all processors which derive from TProcessor.
Declaration
public void RemoveProcessor<TProcessor>()
  Type Parameters
| Name | Description | 
|---|---|
| TProcessor | 
SetDefaultStorageType(Type, Type)
Provide a default storage type for the given abstract or interface type. If a type is deserialized which contains an interface/abstract field type and a mapping is provided, the mapped type will be used by default. For example, IList{T} => List{T} or IDictionary{TKey, TValue} => Dictionary{TKey, TValue}.
Declaration
public void SetDefaultStorageType(Type abstractType, Type defaultStorageType)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Type | abstractType | |
| Type | defaultStorageType | 
StripDeserializationMetadata(ref fsData)
Strips all deserialization metadata from the object, like $type and $content fields.
Declaration
public static void StripDeserializationMetadata(ref fsData data)
  Parameters
| Type | Name | Description | 
|---|---|---|
| fsData | data | 
Remarks
After making this call, you will not be able to deserialize the same object instance. The metadata is strictly necessary for deserialization!
TryDeserialize(fsData, Type, ref Object)
Attempts to deserialize a value from a serialized state.
Declaration
public fsResult TryDeserialize(fsData data, Type storageType, ref object result)
  Parameters
| Type | Name | Description | 
|---|---|---|
| fsData | data | |
| Type | storageType | |
| Object | result | 
Returns
| Type | Description | 
|---|---|
| fsResult | 
TryDeserialize(fsData, Type, Type, ref Object)
Attempts to deserialize a value from a serialized state.
Declaration
public fsResult TryDeserialize(fsData data, Type storageType, Type overrideConverterType, ref object result)
  Parameters
| Type | Name | Description | 
|---|---|---|
| fsData | data | |
| Type | storageType | |
| Type | overrideConverterType | |
| Object | result | 
Returns
| Type | Description | 
|---|---|
| fsResult | 
TryDeserialize<T>(fsData, ref T)
Generic wrapper around TryDeserialize that simply forwards the call.
Declaration
public fsResult TryDeserialize<T>(fsData data, ref T instance)
  Parameters
| Type | Name | Description | 
|---|---|---|
| fsData | data | |
| T | instance | 
Returns
| Type | Description | 
|---|---|
| fsResult | 
Type Parameters
| Name | Description | 
|---|---|
| T | 
TrySerialize(Type, Object, out fsData)
Serialize the given value.
Declaration
public fsResult TrySerialize(Type storageType, object instance, out fsData data)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Type | storageType | The type of field/property that stores the object instance. This is important particularly for inheritance, as a field storing an IInterface instance should have type information included.  | 
      
| Object | instance | The actual object instance to serialize.  | 
      
| fsData | data | The serialized state of the object.  | 
      
Returns
| Type | Description | 
|---|---|
| fsResult | If serialization was successful.  | 
      
TrySerialize(Type, Type, Object, out fsData)
Serialize the given value.
Declaration
public fsResult TrySerialize(Type storageType, Type overrideConverterType, object instance, out fsData data)
  Parameters
| Type | Name | Description | 
|---|---|---|
| Type | storageType | The type of field/property that stores the object instance. This is important particularly for inheritance, as a field storing an IInterface instance should have type information included.  | 
      
| Type | overrideConverterType | An fsBaseConverter derived type that will be used to serialize the object instead of the converter found via the normal discovery mechanisms.  | 
      
| Object | instance | The actual object instance to serialize.  | 
      
| fsData | data | The serialized state of the object.  | 
      
Returns
| Type | Description | 
|---|---|
| fsResult | If serialization was successful.  | 
      
TrySerialize<T>(T, out fsData)
Helper method that simply forwards the call to TrySerialize(typeof(T), instance, out data);
Declaration
public fsResult TrySerialize<T>(T instance, out fsData data)
  Parameters
| Type | Name | Description | 
|---|---|---|
| T | instance | |
| fsData | data | 
Returns
| Type | Description | 
|---|---|
| fsResult | 
Type Parameters
| Name | Description | 
|---|---|
| T |