Survey.Net.Domain 0.1.0

.NET 5.0
Install-Package Survey.Net.Domain -Version 0.1.0
dotnet add package Survey.Net.Domain --version 0.1.0
<PackageReference Include="Survey.Net.Domain" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Survey.Net.Domain --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Survey.Net.Domain, 0.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Survey.Net.Domain as a Cake Addin
#addin nuget:?package=Survey.Net.Domain&version=0.1.0

// Install Survey.Net.Domain as a Cake Tool
#tool nuget:?package=Survey.Net.Domain&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Survey.Net - Simple C# Survey Library

Getting started

A "Getting started" as prescribed by tradition.

Examples

The Survey class is basically a container for survey pages and responses.
Adding questions requires you to first add a QuestionPage to the survey.

/*
 * Simple example of constructing a survey
 */
var survey = new Survey("Survey title");

//Add questions to survey.
// -- Any type implementing IQuestion can be added.
var firstPage = survey.AddPage<QuestionPage>("First page with questions");
firstPage.AddQuestion(new TextQuestion("What's your name?"));
firstPage.AddQuestion(new MultipleChoiceQuestion("Pick one", new [] {
    new Option("First option", "first value"),
    new Option("Second option", "second value"),
    new Option("Third option", 1),
}));


 // Add response to a question.
 // -- Response QuestionText property indicates which question the response is for.
survey.AddResponse(new Response(QuestionText: "What's your name?", Value: "Nicklas"));


// Get responses
string responsesAsJson = JsonConvert.SerializeObject(survey.Responses, Formatting.Indented);
Console.WriteLine(responsesAsJson);

The survey class provides a few navigation methods, such as moving forward and backwards through the survey pages.

/*
 * Navigating the survey using its methods.
 */
var survey = new Survey("Survey");
            
// Calling AddPage<T> sets the CurrentPage to the newly created page.
survey.AddPage<QuestionPage>("First page");
survey.AddPage<QuestionPage>("Second page");
survey.AddPage<QuestionPage>("Third page");

ISurveyPage? lastPage = survey.CurrentPage;  // <- "Third page"
survey.PreviousPage();  // <- CurrentPage is now "Second page"
survey.NextPage();  // <- CurrentPage is back to "Third page".

survey.GoToPage(0); // <- CurrentPage is set to the first page

Survey.Net concepts and approach to survey logic

The starting point is the Survey, and is the main object you should work with.
A survey is composed of several parts several pages, which may be a front page, question page, or thank you page.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • 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.

Version Downloads Last updated
0.1.0 236 12/24/2020