StacMan is a .NET client for Stack Exchange API v2
C#
Latest commit b9e9ca6 Nov 30, 2015 @emmettnicholas Merge pull request #9 from petrsvihlik/patch-1
Added syntax highlighting to the examples

README.md

Features

Get StacMan

StacMan is available on NuGet:

PM> Install-Package StacMan

Example Usage

using StackExchange.StacMan;
...
var client = new StacManClient(key: "my-app-key", version: "2.1");

Synchronous

var response = client.Questions.GetAll("stackoverflow",
    page: 1,
    pagesize: 10,
    sort: Questions.AllSort.Creation,
    order: Order.Desc,
    filter: "!mDO35lQRaz").Result;

foreach (var question in response.Data.Items)
{
    Console.WriteLine(question.Title);
}

Asynchronous

var task = client.Questions.GetAll("stackoverflow",
    page: 1,
    pagesize: 10,
    sort: Questions.AllSort.Creation,
    order: Order.Desc,
    filter: "!mDO35lQRaz");

task.ContinueWith(t =>
    {
        foreach (var user in t.Result.Data.Items)
        {
            Console.WriteLine(question.Title);
        }
    });

Asynchronous (C# 5)

var response = await client.Questions.GetAll("stackoverflow",
    page: 1,
    pagesize: 10,
    sort: Questions.AllSort.Creation,
    order: Order.Desc,
    filter: "!mDO35lQRaz");

foreach (var user in response.Data.Items)
{
    Console.WriteLine(question.Title);
}

Filters

StacMan supports the Stack Exhchange API's concept of filters, which allow applications to specify which fields are included/excluded in the API response.

When a field is excluded, the property returned by StacMan corresponding to the excluded field assumes the default value of the type. For example, when the "default" filter is used, the AnswerCount property of the User object returned by StacMan will be 0, since user.answer_count is not included by the "default" filter.