cc0a0b42 bd84 3aa8 1865 36f1ab6d3fcf - akesseler/Plexdata.Utilities.Templates GitHub Wiki

DefaultSerializer Class

Acts as default respectively as fallback custom type converter.

Inheritance Hierarchy

System.Object
  Plexdata.Utilities.Formatting.Helpers.DefaultSerializer
Namespace: Plexdata.Utilities.Formatting.Helpers
Assembly: Plexdata.Utilities.Templates (in Plexdata.Utilities.Templates.dll) Version: 1.0.0

Syntax

C#

internal class DefaultSerializer : IArgumentSerializer

The DefaultSerializer type exposes the following members.

Constructors

 

Name Description
Public method DefaultSerializer Default construction.
  Back to Top

Properties

 

Name Description
Public property Recursions The depth of recursions for serialization.
  Back to Top

Methods

 

Name Description
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Private method GetProperties Loads affected properties from provided type>
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Private method IsProcessable Validates whether a particular property can be processed.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Private method Render Renders the value into result.
Public method Serialize Converts the argument into a string.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
  Back to Top

Extension Methods

 

Name Description
Private Extension Method CanExpand Determines whether the argument can be expanded. (Defined by ArgumentExtension.)
Public Extension Method IsSystemType Determines whether an argument is of a build-in system type. (Defined by ArgumentExtension.)
  Back to Top

Remarks

This class represents the default or in other words the fallback converter for any custom type.

Task of this class is the conversion of custom types into their flat string representation. Flat means in detail that property parsing is not done recursively. See enumeration below to get an impression about additional rules.  

  • Each top-level object is surrounded by square brackets ([...]).
  • Each affected property is formatted as combination of property name and property value (<label>: <value>).
  • Each combination of property name and value is separated by a semicolon followed by one space (;).
  • Strings as well as single characters are surrounded by double quotes ("some string").
  • Values of properties of type Char that represent a control character are converted into their hexadecimal unicode representation (\u0000).
  • Objects with a value of null are converted into the string null.
  • Objects of type class are serialized by their own method ToString(). Additionally, such classes are put into surrounding square brackets ([...]).

See Also

Reference

Plexdata.Utilities.Formatting.Helpers Namespace
Plexdata.Utilities.Formatting.Interfaces.IArgumentSerializer

⚠️ **GitHub.com Fallback** ⚠️