> 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/3.1/api/csharp/yarn.compiler/yarn.compiler.compilationjob/yarn.compiler.compilationjob.createfromstring.md).

# CreateFromString(string,string,Library?,int)

Method in [CompilationJob](/3.1/api/csharp/yarn.compiler/yarn.compiler.compilationjob.md)

## Summary

Creates a new [CompilationJob](/3.1/api/csharp/yarn.compiler/yarn.compiler.compilationjob.md) using the contents of a string.

```csharp
public static CompilationJob CreateFromString(string fileName, string source, Library? library = null, int languageVersion = Project.CurrentProjectFileVersion)
```

## Parameters

| Name                                                         | Description                                                |
| ------------------------------------------------------------ | ---------------------------------------------------------- |
| `string` fileName                                            | The name to assign to the compiled file.                   |
| `string` source                                              | The text to compile.                                       |
| [Yarn.Library](/3.1/api/csharp/yarn/yarn.library.md) library | Library of function definitions to use during compilation. |
| `int` languageVersion                                        | The version of the Yarn language to use.                   |

## Returns

A new [CompilationJob](/3.1/api/csharp/yarn.compiler/yarn.compiler.compilationjob.md) .
