using Microsoft.CSharp; using System.CodeDom.Compiler; var providerOptions = new Dictionary{ { "CompilerVersion", "v4.0" } }; using (var provider = new CSharpCodeProvider(providerOptions)) { var parameters = new CompilerParameters(new [] { "System.Data.SQLite.dll" }); var result = provider.CompileAssemblyFromFile(parameters, "Program.cs"); }
using Newtonsoft.Json; var jsonString = "{\"name\": \"John Doe\"}"; var person = JsonConvert.DeserializeObjectIn this example, we're using the Newtonsoft.Json package to deserialize a JSON string into a C# object. We don't need to manually reference the package using AddReferences as it is handled by the NuGet package manager. In both examples, we were able to determine the package/library required and its name by reading the documentation or using a package manager such as NuGet.(jsonString);