Survey.Net.Domain
0.1.0
dotnet add package Survey.Net.Domain --version 0.1.0
NuGet\Install-Package Survey.Net.Domain -Version 0.1.0
<PackageReference Include="Survey.Net.Domain" Version="0.1.0" />
paket add Survey.Net.Domain --version 0.1.0
#r "nuget: Survey.Net.Domain, 0.1.0"
// 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
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 Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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. |
-
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 | 439 | 12/24/2020 |