TSVTools 1.1.0
dotnet add package TSVTools --version 1.1.0
NuGet\Install-Package TSVTools -Version 1.1.0
<PackageReference Include="TSVTools" Version="1.1.0" />
paket add TSVTools --version 1.1.0
#r "nuget: TSVTools, 1.1.0"
// Install TSVTools as a Cake Addin #addin nuget:?package=TSVTools&version=1.1.0 // Install TSVTools as a Cake Tool #tool nuget:?package=TSVTools&version=1.1.0
TSVTools
TSVTools is a lightweight library that makes it easy to read and write TSV (tab-separated values) files in C#. It provides a simple and intuitive interface for working with TSV files, allowing you to quickly and easily read and write data in TSV format.
Installation
You can install TSVTools via NuGet using the following command:
dotnet add package TSVTools --version 1.0.4
or
NuGet\Install-Package TSVTools -Version 1.0.4
Usage
First you need write your input model:
public class MyDataModel
{
public string Name { get; set; }
public int Age { get; set; }
public string Email { get; set; }
}
Reading from a TSV file
To read data from a TSV file, you first need to create an instance of the TsvFile
class with the path to the TSV file:
var tsvFile = new TsvFile<MyDataModel>("path.tsv");
This will create a TsvFile<MyDataModel>
object that you can use to access the data in the TSV file.
Writing to a TSV file
To write data to a TSV file, you first need to create an instance of the TsvFile
class with the column names for the TSV file:
var tsvFile = new TsvFile<MyDataModel>();
You can then add data to the TsvFile
object by creating instances of your MyDataModel
class and adding them to the TsvFile
object:
var data = new MyDataModel { Name = "MHReza", Age = 18, Email = "mh.shahmorady@gmail.com" };
tsvFile.AddRow(data);
Once you have added all your data to the TsvFile
object, you can save the data to a TSV file:
tsvFile.SaveToFile("path.tsv");
This will save the data to a TSV file at the specified path.
you can read data like this:
foreach (var row in tsvFile)
{
Console.WriteLine($"Name: {row.Name} , age is : {row.Age} , Email is {row.Email}");
}
for updating a row you use UpdateRow method
tsvFile.UpdateRow(1, new MyDataModel {Name = "", Age = 18, Email = ""});
for get row with index you can use GetRow method
tsvFile.GetRow(1);
Appending a TSV file tp your data
To append data from a TSV file to your data, you can use the AppendFile
method:
tsvFile.AppendFile("path/to/my/existing/tsv/file.tsv");
Export to a csv file
For export your data in csv file format you can use this method:
tsvFile.ExportToCsv("FilePath.csv");
Contributing
If you'd like to contribute to TSVTools, please submit a pull request or open an issue. We welcome all feedback and contributions!
Product | Versions 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- 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.