TextSerializer<TTargetType> class

Base class that contains common code for the CsvSerializer and FixedWidthSerializer class.

public abstract class TextSerializer<TTargetType>
    where TTargetType : new()
parameter description
TTargetType The type of object that will be serialized. Either TargetType must have the TextSerializable attribute applied, and any fields contained must have the TextField attribute applied to them, or the Fluent Configuration model must be used.

Public Members

name description
Fields { get; } Dictionary of Fields which have been configured for this Serializer. The Key is the Position, and the Value is the Field definition class.
TargetType { get; } The type which will be created for each record in the file.
Deserialize(…) Creates a single TargetType object given a record string.
DeserializeArray(…) Creates a collection of TargetType objects from the data in the passed in stream. (2 methods)
DeserializeEnumerable(…) Deserializes a file one record at a time suitable for usage in a foreach loop.
Serialize(…) Serializes a single TargetType object into a properly formatted record string.
SerializeArray(…) Serializes a collection of TargetType objects to the given TextWriter.

Protected Members

name description
TextSerializer() Default constructor for the base type. Does only basic initialization of the TargetType.
abstract FormatOutput(…) Write out a list of fields in the correct format.
abstract GetFieldFromAttribute(…) Used by a derived class to return a Field configuration specific to this serializer back for a given method based on the attributes applied.
InitializeFromAttributes() Initializes the field definitions for this class using Attributes, which occurs if a Fluent Configuration is not passed into the Constructor.
abstract Parse(…) Parses a line of text as a record and returns the fields.

See Also