Class CSVSerializer
Serializer fo reading/writing objects to CSV files.
Inherited Members
Namespace: Quantellia.WMServer.Serialization
Assembly: WMServer.dll
Syntax
public class CSVSerializer : ISerializer, IDisposable
Constructors
CSVSerializer(string?)
Create a new instance of a CSVSerializer and optionally set the filename.
Declaration
public CSVSerializer(string? connection = null)
Parameters
Type | Name | Description |
---|---|---|
string | connection | The file name (relative or absolute) from/to which data will be read/written |
Properties
Connection
The file name (relative or absolute) of the CSV file to access.
Declaration
public string? Connection { get; set; }
Property Value
Type | Description |
---|---|
string |
DataSource
Get a reference to the internal CSV read or write object, if one of them currently exists.
Declaration
public object DataSource { get; }
Property Value
Type | Description |
---|---|
object |
Methods
Close()
Close this serializer. Closes and Disposes of all open streams.
Declaration
public void Close()
DeserializeObjects<T>(Func<T, bool>)
Declaration
public List<T> DeserializeObjects<T>(Func<T, bool> filter)
Parameters
Type | Name | Description |
---|---|---|
Func<T, bool> | filter |
Returns
Type | Description |
---|---|
List<T> |
Type Parameters
Name | Description |
---|---|
T |
Dispose()
Declaration
public void Dispose()
Open()
Opens the CSVSerializer for reading or writing. Note that
the mode
argument must be specified or an exception will be thrown.
Declaration
public void Open()
SerializeObject(object, SerializationParams?)
Declaration
public void SerializeObject(object srzObj, SerializationParams? srzParams = null)
Parameters
Type | Name | Description |
---|---|---|
object | srzObj | |
SerializationParams | srzParams |
SerializeObjects(IEnumerable<object>, SerializationParams?)
Serialize the specified collection of ojects to CSV format, and write them to the location specified in the Connection property.
Declaration
public void SerializeObjects(IEnumerable<object> srzObjs, SerializationParams? srzParams = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<object> | srzObjs | |
SerializationParams | srzParams |