> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x.com/llms.txt
> Use this file to discover all available pages before exploring further.

# C# / .NET XDK

> C# and .NET client library for the X API v2.

`XDevPlatform.Xdk` is the official C# / .NET SDK for the X API v2 (.NET 8+). It uses `System.Net.Http` and `System.Text.Json` with no extra runtime dependencies, async methods with `CancellationToken`, `IAsyncEnumerable<T>` pagination, and `EventStream<T>`.

> [card] [NuGet](https://www.nuget.org/packages/XDevPlatform.Xdk)
>
> `dotnet add package XDevPlatform.Xdk` · .NET 8+

> [card] [GitHub](https://github.com/xdevplatform/xdk-csharp)
>
> Source code and issues.

## Quick example

```csharp theme={null}
using System;
using System.Collections.Generic;
using Xdk;
using Xdk.Clients;

using var client = new XClient(new XClientOptions
{
    BearerToken = Environment.GetEnvironmentVariable("X_BEARER_TOKEN"),
});

var response = await client.Users.GetByUsernameAsync(
    "XDevelopers",
    new UsersClient.GetByUsernameOptions
    {
        UserFields = new List<string> { "created_at", "public_metrics" },
    });

Console.WriteLine(response.Data);
```

## Guides

> [card] [Install](https://docs.x.com/xdks/csharp/install.md)
>
> Add `XDevPlatform.Xdk` from NuGet.

> [card] [Quickstart](https://docs.x.com/xdks/csharp/quickstart.md)
>
> Make your first request.

> [card] [Authentication](https://docs.x.com/xdks/csharp/authentication.md)
>
> Bearer Token, OAuth 2.0 PKCE, and OAuth 1.0a.

> [card] [Pagination](https://docs.x.com/xdks/csharp/pagination.md)
>
> Iterate pages with `await foreach`.

> [card] [Streaming](https://docs.x.com/xdks/csharp/streaming.md)
>
> Read live streams with `EventStream<T>`.

> [card] [API Reference](https://docs.x.com/xdks/csharp/reference/overview.md)
>
> Methods and parameters for each client.
