-
Notifications
You must be signed in to change notification settings - Fork 19
1. Getting started with ConTabs
Tom Wright edited this page Feb 2, 2018
·
1 revision
The easiest way to install ConTabs is to use your package manager to pull it from NuGet.
In Visual Studio, this can be done by searching for "ConTabs" in the package manager UI, or by running the following in the package manager console:
Install-Package ConTabs.tdwright
If you're using the .NET CLI, you need to:
dotnet add package ConTabs.tdwright
It's also possible to download the package manually from the NuGet gallery.
ConTabs works by accepting an IEnumerable of your data type, so you'll first need to make sure you've got one of those. For this guide, I've got an List of type Planet called Planets.
Turning your list into a table, can be as simple as:
var table = Table<Planet>.Create(Planets);
Console.WriteLine(table.ToString());Those two lines will produce the following:
+---------+-----------------+---------------+
| Name | DistanceFromSun | OrbitalPeriod |
+---------+-----------------+---------------+
| Mercury | 57909227 | 88 |
| Venus | 108209475 | 225 |
| Earth | 149598262 | 365.24 |
| Mars | 227943824 | 693.5 |
| Jupiter | 778340821 | 4343.5 |
| Saturn | 1426666422 | 10767.5 |
| Uranus | 2870658186 | 30660 |
| Neptune | 4498396441 | 60152 |
+---------+-----------------+---------------+
Easy, right?