> For the complete documentation index, see [llms.txt](https://docs.yarnspinner.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yarnspinner.dev/2.2/api/csharp/yarn.compiler/yarn.compiler.utility.md).

# Utility

Class in [Yarn.Compiler](/2.2/api/csharp/yarn.compiler.md)

Inherits from `System.Object`

## Summary

Utility methods for working with line tags.

```csharp
public static class Utility
```

## Methods

| Name                                                                                                                                                                                                                                       | Description                                                                                                                       |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------- |
| [AddTagsToLines(string,ICollection)](/2.2/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.addtagstolines.md)                                                                                                          | Given Yarn source code, adds line tags to the ends of all lines that need one and do not already have one.                        |
| [DetermineNodeConnections(string\[\])](/2.2/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.determinenodeconnections.md)                                                                                              | Finds and collates every jump in every node.                                                                                      |
| [ExtractStringBlocks(IEnumerable)](/2.2/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.extractstringblocks.md)                                                                                                       |                                                                                                                                   |
| [GenerateYarnFileWithDeclarations(IEnumerable\<Yarn.Compiler.Declaration>,string,IEnumerable,IDictionary\<string, string>)](/2.2/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.generateyarnfilewithdeclarations.md) | Generates a Yarn script that contains a node that declares variables.                                                             |
| [ParseSource(string)](/2.2/api/csharp/yarn.compiler/yarn.compiler.utility/yarn.compiler.utility.parsesource.md)                                                                                                                            | Parses a string of Yarn source code, and produces a FileParseResult and (if there were any problems) a collection of diagnostics. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/2.2/api/csharp/yarn.compiler/yarn.compiler.utility.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.
