# Yarn Namespace

## Summary

Contains classes for working with compiled Yarn programs.

## Classes

| Name                                                                      | Description                                                                                                                                                              |
| ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [ConstantTypeProperty](/3.1/api/csharp/yarn/yarn.constanttypeproperty.md) | Represents a property that belongs to a type and contains a read-only value.                                                                                             |
| [Dialogue](/3.1/api/csharp/yarn/yarn.dialogue.md)                         | Co-ordinates the execution of Yarn programs.                                                                                                                             |
| [DialogueException](/3.1/api/csharp/yarn/yarn.dialogueexception.md)       | An exception that is thrown by [Dialogue](/3.1/api/csharp/yarn/yarn.dialogue.md) when there is an error in executing a [Program](/3.1/api/csharp/yarn/yarn.program.md) . |
| [EnumBase](/3.1/api/csharp/yarn/yarn.enumbase.md)                         | The base type for all enumeration types.                                                                                                                                 |
| [EnumType](/3.1/api/csharp/yarn/yarn.enumtype.md)                         | A type that represents enumerations.                                                                                                                                     |
| [FunctionType](/3.1/api/csharp/yarn/yarn.functiontype.md)                 | A type that represents a function.                                                                                                                                       |
| [Header](/3.1/api/csharp/yarn/yarn.header.md)                             |                                                                                                                                                                          |
| [Library](/3.1/api/csharp/yarn/yarn.library.md)                           | A collection of functions that can be called from Yarn programs.                                                                                                         |
| [MemoryVariableStore](/3.1/api/csharp/yarn/yarn.memoryvariablestore.md)   | A simple concrete implementation of [IVariableStorage](/3.1/api/csharp/yarn/yarn.ivariablestorage.md) that keeps all variables in memory.                                |
| [Node](/3.1/api/csharp/yarn/yarn.node.md)                                 | A node of Yarn script, contained within a [Program](/3.1/api/csharp/yarn/yarn.program.md) , and containing `Yarn.Instruction` s.                                         |
| [Program](/3.1/api/csharp/yarn/yarn.program.md)                           | A compiled Yarn program.                                                                                                                                                 |
| [TypeBase](/3.1/api/csharp/yarn/yarn.typebase.md)                         | Provides the base class for all concrete types.                                                                                                                          |
| [Types](/3.1/api/csharp/yarn/yarn.types.md)                               | Contains the built-in types available in the Yarn language.                                                                                                              |

## Delegates

| Name                                                                            | Description                                                                                                                            |
| ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| [CommandHandler](/3.1/api/csharp/yarn/yarn.commandhandler.md)                   | Represents the method that is called when the Dialogue delivers a [Command](/3.1/api/csharp/yarn/yarn.command.md) .                    |
| [DialogueCompleteHandler](/3.1/api/csharp/yarn/yarn.dialoguecompletehandler.md) | Represents the method that is called when the dialogue has reached its end, and no more code remains to be run.                        |
| [LineHandler](/3.1/api/csharp/yarn/yarn.linehandler.md)                         | Represents the method that is called when the Dialogue delivers a [Line](/3.1/api/csharp/yarn/yarn.line.md) .                          |
| [Logger](/3.1/api/csharp/yarn/yarn.logger.md)                                   | Represents a method that receives diagnostic messages and error information from a [Dialogue](/3.1/api/csharp/yarn/yarn.dialogue.md) . |
| [NodeCompleteHandler](/3.1/api/csharp/yarn/yarn.nodecompletehandler.md)         | Represents the method that is called when the Dialogue reaches the end of a node.                                                      |
| [NodeStartHandler](/3.1/api/csharp/yarn/yarn.nodestarthandler.md)               | Represents the method that is called when the Dialogue begins executing a node.                                                        |
| [OptionsHandler](/3.1/api/csharp/yarn/yarn.optionshandler.md)                   | Represents the method that is called when the Dialogue delivers an [OptionSet](/3.1/api/csharp/yarn/yarn.optionset.md) .               |
| [PrepareForLinesHandler](/3.1/api/csharp/yarn/yarn.prepareforlineshandler.md)   | Represents the method that is called when the dialogue anticipates that it will deliver lines.                                         |

## Enums

| Name                                                      | Description                                                                                                                                                                                                                              |
| --------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [VariableKind](/3.1/api/csharp/yarn/yarn.variablekind.md) | Represents different kinds of variables that can be fetched from a [Dialogue](/3.1/api/csharp/yarn/yarn.dialogue.md) using [TryGetValue\<T>(string,T?)](/3.1/api/csharp/yarn/yarn.ivariableaccess/yarn.ivariableaccess.trygetvalue.md) . |

## Interfaces

| Name                                                                            | Description                                                                                                                      |
| ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| [IMarkupParser](/3.1/api/csharp/yarn/yarn.imarkupparser.md)                     | Contains methods for parsing raw text into a [MarkupParseResult](/3.1/api/csharp/yarn.markup/yarn.markup.markupparseresult.md) . |
| [ISmartVariableEvaluator](/3.1/api/csharp/yarn/yarn.ismartvariableevaluator.md) | Contains methods for evaluating the value of smart variables                                                                     |
| [IType](/3.1/api/csharp/yarn/yarn.itype.md)                                     | Defines properties that describe a type in the Yarn language.                                                                    |
| [ITypeMember](/3.1/api/csharp/yarn/yarn.itypemember.md)                         | Provides properties used to work with members of a type.                                                                         |
| [IVariableAccess](/3.1/api/csharp/yarn/yarn.ivariableaccess.md)                 | Provides a mechanism for retrieving values.                                                                                      |
| [IVariableStorage](/3.1/api/csharp/yarn/yarn.ivariablestorage.md)               | Provides a mechanism for storing values.                                                                                         |
| [IYarnValue](/3.1/api/csharp/yarn/yarn.iyarnvalue.md)                           | Represents a read-only value in the Yarn Spinner virtual machine.                                                                |

## Namespaces

| Name                                              | Description                                                                               |
| ------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| [Yarn.Compiler](/3.1/api/csharp/yarn.compiler.md) | Contains classes for compiling Yarn code.                                                 |
| [Yarn.Markup](/3.1/api/csharp/yarn.markup.md)     | Contains classes for working with markup in Yarn lines.                                   |
| [Yarn.Saliency](/3.1/api/csharp/yarn.saliency.md) | Contains classes for choosing the most relevant content out of a set of possible options. |
| [Yarn.Unity](/3.1/api/csharp/yarn.unity.md)       | Contains classes for working with Yarn Spinner in the Unity game engine.                  |
| [Yarn.Utility](/3.1/api/csharp/yarn.utility.md)   | Contains utility classes used by Yarn Spinner.                                            |

## Structs

| Name                                                | Description                                                                                                                                                     |
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Command](/3.1/api/csharp/yarn/yarn.command.md)     | A command, sent from the [Dialogue](/3.1/api/csharp/yarn/yarn.dialogue.md) to the game.                                                                         |
| [Line](/3.1/api/csharp/yarn/yarn.line.md)           | A line of dialogue, sent from the [Dialogue](/3.1/api/csharp/yarn/yarn.dialogue.md) to the game.                                                                |
| [OptionSet](/3.1/api/csharp/yarn/yarn.optionset.md) | A set of [Option](/3.1/api/csharp/yarn/yarn.optionset/yarn.optionset.option.md) s, sent from the [Dialogue](/3.1/api/csharp/yarn/yarn.dialogue.md) to the game. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yarnspinner.dev/3.1/api/csharp/yarn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
