57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
namespace MeetTheTeacher.Model;
|
|
|
|
/// <summary>
|
|
/// Represents a single entity as a CSV processable object.
|
|
/// </summary>
|
|
public sealed class CsvData
|
|
{
|
|
/// <summary>
|
|
/// Separator used in CSV files
|
|
/// </summary>
|
|
public const char Separator = ';';
|
|
|
|
/// <summary>
|
|
/// Creates a new instance of <see cref="CsvData" />
|
|
/// </summary>
|
|
/// <param name="headerNames">Header column names for the entity which has its data represented by this object</param>
|
|
/// <param name="data">Data column values for the entity which has its data represented by this object; stringly typed</param>
|
|
public CsvData(IReadOnlyList<string> headerNames, IReadOnlyList<string> data)
|
|
{
|
|
HeaderNames = headerNames;
|
|
Data = data;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the header column names for the entity which has its data represented by this object
|
|
/// </summary>
|
|
public IReadOnlyList<string> HeaderNames { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the data column values for the entity which has its data represented by this object; stringly typed
|
|
/// </summary>
|
|
public IReadOnlyList<string> Data { get; }
|
|
|
|
/// <summary>
|
|
/// Gets a CSV header based on <see cref="HeaderNames" />
|
|
/// </summary>
|
|
/// <returns>A CSV header line</returns>
|
|
public string GetHeader() => null!; // TODO
|
|
|
|
/// <summary>
|
|
/// Gets a CSV data line based on <see cref="Data" />
|
|
/// </summary>
|
|
/// <returns>A CSV data line</returns>
|
|
public string GetData() => null!; // TODO
|
|
|
|
/// <summary>
|
|
/// Allows to deconstruct the object into its header and data parts
|
|
/// </summary>
|
|
/// <param name="headerNames">Set to <see cref="HeaderNames" /></param>
|
|
/// <param name="data">Set to <see cref="Data" /></param>
|
|
public void Deconstruct(out IReadOnlyList<string> headerNames, out IReadOnlyList<string> data)
|
|
{
|
|
// TODO
|
|
headerNames = null!;
|
|
data = null!;
|
|
}
|
|
}
|