Table of Contents

TL;DR

Add the Xdg.Directories package to your project:

dotnet add package Xdg.Directories

Then use the BaseDirectory and UserDirectory classes to access the XDG directories:

using System;
using Xdg.Directories;

// Prints /home/$USER/.local/share
Console.Writeline(BaseDirectory.DataHome);

// Prints /home/$USER/Documents
Console.Writeline(UserDirectory.DocumentsDir);

For more information, see the API documentation.