ZimLabs.TableCreator 1.5.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ZimLabs.TableCreator --version 1.5.0                
NuGet\Install-Package ZimLabs.TableCreator -Version 1.5.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZimLabs.TableCreator" Version="1.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ZimLabs.TableCreator --version 1.5.0                
#r "nuget: ZimLabs.TableCreator, 1.5.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ZimLabs.TableCreator as a Cake Addin
#addin nuget:?package=ZimLabs.TableCreator&version=1.5.0

// Install ZimLabs.TableCreator as a Cake Tool
#tool nuget:?package=ZimLabs.TableCreator&version=1.5.0                

ZimLabs.TableCreator

GitHub release (latest by date) Nuget

This library is not very special 😃 It takes a list of objects and creates an ASCII "table", markdown table or a CSV list. Very simple and straight forward.


Content

Install

PM > Install-Package ZimLabs.TableCreator

Usage

Attributes:

internal sealed class Person
{
    [Appearance(TextAlign = TextAlign.Right, Order = 1)]
    public int Id { get; set; }

    [Appearance(Name = "First name", Order = 3)]
    public string Name { get; set; }

    [Appearance(Order = 2)]
    public string LastName { get; set; }

    [Appearance(Name = "E-Mail", Order = 4)]
    public string Mail { get; set; }

    [Appearance(Ignore = true)]
    public string Gender { get; set; }

    [Appearance(Name = "Job title")]
    public string JobTitle { get; set; }

    [Appearance(Format = "yyyy-MM-dd")]
    public DateTime Birthday { get; set; }
}

Note: If not all properties have an Order value, the following order is applied:

  1. occurrence in the class
  2. order according to Order value

Usage of the Create / Save methods:

var personList = CreateDummyList().ToList();

// Print the complete list
Console.WriteLine("Person List");
Console.WriteLine(personList.CreateTable());

// Save the person list
personList.SaveTable("PersonList.txt");

// Print a single person
var person = personList.FirstOrDefault();

Console.WriteLine("Single person");
Console.WriteLine("Value list");
Console.WriteLine(person.CreateValueList());

Console.WriteLine("Value table");
Console.WriteLine(person.CreateValueTable());

// Save the person (as value list)
person.SaveValue("FileName.txt");

// Save the person (as table)
person.SaveValueAsTable("FileName.txt");

Console.WriteLine("Done");
Console.ReadLine();

The result:

Person List
+-------------------------------+------------+----+-------------+------------+-------------------------------+
| Job title                     | Birthday   | Id | LastName    | First name | E-Mail                        |
+-------------------------------+------------+----+-------------+------------+-------------------------------+
| Environmental Tech            | 1968-03-26 |  1 | Giblin      | Tommy      | tgiblin0@amazon.co.uk         |
| Teacher                       | 1952-04-24 |  2 | Puden       | Sven       | spuden1@soundcloud.com        |
| VP Quality Control            | 1965-04-10 |  3 | Czaple      | Garvy      | gczaple2@com.com              |
| Pharmacist                    | 1986-07-23 |  4 | Mariotte    | Eryn       | emariotte3@issuu.com          |
| Senior Financial Analyst      | 1967-11-09 |  5 | Oiseau      | Zaccaria   | zoiseau4@huffingtonpost.com   |
+-------------------------------+------------+----+-------------+------------+-------------------------------+

Single person
Value list
- Job title.: Environmental Tech
- Birthday..: 26/03/1968 00:00:00
- Id........: 1
- LastName..: Giblin
- First name: Tommy
- E-Mail....: tgiblin0@amazon.co.uk

Value table
+------------+-----------------------+
| Key        | Value                 |
+------------+-----------------------+
| Job title  | Environmental Tech    |
| Birthday   | 26/03/1968 00:00:00   |
| Id         | 1                     |
| LastName   | Giblin                |
| First name | Tommy                 |
| E-Mail     | tgiblin0@amazon.co.uk |
+------------+-----------------------+

Known issues

Currently it's possible to call the methods for a single entry with a list:

// Wrong call
personList.CreateValueList();

I'll try to fix the bug in the next version (1.5).

Since I didn't find a solution to prevent calling the method for a single value, I included a check that throws an error when trying to call the method for a single value from a list.

If you call from a list a function, which was developed only for a single value, an NotSupportedException with the following message will be thrown:

The specified type is not supported by this method. Please choose "CreateTable" or "SaveTable" instead.

Sorry for the inconvenience.

Changelog

Version 1.5.0

Added check function to the following methods

  • CreateValueTable
  • SaveValue
  • SaveValueAsTable

The function checks if the given value is a list or not. If the value is a list an exception (NotSupportedException) will be thrown.

For more information see Known issues.

I also removed the documentation for the classes, because the tool I use for that doesn't seem to cope with .NET Standard, so the documentation wasn't updated anymore.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.1 520 2/25/2024
2.1.0 201 12/15/2023
2.0.2 238 9/15/2023
2.0.1 316 4/27/2023
2.0.0 205 4/27/2023
1.5.0 551 3/19/2023
1.4.1 349 2/5/2023
1.4.0 273 2/5/2023
1.3.1 6,516 1/21/2022
1.3.0 502 1/19/2022
1.2.4 318 12/29/2021
1.2.3 330 12/29/2021 1.2.3 is deprecated because it is no longer maintained.
1.2.2 349 12/29/2021 1.2.2 is deprecated because it is no longer maintained.
1.2.1 382 10/29/2021
1.2.0 450 5/8/2021
1.1.2 370 5/8/2021
1.1.1 450 12/23/2020
1.1.0 436 12/11/2020
1.0.1 433 11/19/2020
1.0.0 637 10/31/2020

- Fixed a minor bug (Ignore value was fetched wrong)