# Load text from string Compare raw text strings directly using LoadOptions.LoadText = true — no files needed. Retrieve the diff result as a string via GetResultString() in GroupDocs.Comparison for .NET. [GroupDocs.Comparison](https://products.groupdocs.com/comparison/net) allows you to compare values from the `string` type variables. To compare text from variables, follow these steps: 1. Instantiate the [LoadOptions](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.options/loadoptions) object. Set the [LoadText](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.options/loadoptions/properties/loadtext) property to `true` (this indicates that passed string contains text to be compared, not file path). 2. Instantiate the [Comparer](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer) object. Specify the source variable of the `string` type and the [LoadOptions](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.options/loadoptions) object created in the previous step. 3. Call the [Add](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer/methods/add/index) method. Specify target variable of the `string` type and the [LoadOptions](https://reference.groupdocs.com/comparison/net/groupdocs.comparison.options/loadoptions) object created in the previous step. 4. Call the [Comparer](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer) method. 5. Call the [GetResultString](https://reference.groupdocs.com/comparison/net/groupdocs.comparison/comparer/methods/getresultstring) method to get string with comparison result. The following code snippet shows how to load values from variables: {{< tabs "example1">}} {{< tab "C#" >}} ```csharp using System; using GroupDocs.Comparison; using GroupDocs.Comparison.Options; // ... using (Comparer comparer = new Comparer("source text", new LoadOptions() { LoadText = true })) { comparer.Add("target text", new LoadOptions() { LoadText = true }); comparer.Compare(); string result = compare.GetResultString(); Console.WriteLine("Result string: \n" + comparer.GetResultString()); } ``` {{< /tab >}} {{< /tabs >}} The result is as follows: ![](https://docs.groupdocs.com/comparison/net/images/load-text-from-string.png) The following code snippet shows how to combine the different ways of specifying documents: {{< tabs "example2">}} {{< tab "C#" >}} ```csharp using System; using GroupDocs.Comparison; using GroupDocs.Comparison.Options; using System.IO; // ... using (Stream sourceStream = File.OpenRead("./source.docx")) { using (Comparer comparer = new Comparer(sourceStream)) { comparer.Add("target text", new LoadOptions() { LoadText = true }); comparer.Compare(); string result = compare.GetResultString(); Console.WriteLine(result); } } ``` {{< /tab >}} {{< /tabs >}} ## See also - [Load file from stream]({{< ref "comparison/net/advanced-usage/loading/load-file-from-stream.md" >}}) - [Load file from local disk]({{< ref "comparison/net/advanced-usage/loading/load-file-from-local-disk.md" >}}) - [Compare documents]({{< ref "comparison/net/comparison-basic/compare-documents.md" >}})