Closed WeihanLi closed 4 months ago
linqpad script sample
<Query Kind="Statements">
<NuGetReference>Microsoft.ML.OnnxRuntimeGenAI</NuGetReference>
<NuGetReference>WeihanLi.Common</NuGetReference>
<Namespace>WeihanLi.Common</Namespace>
<Namespace>WeihanLi.Common.Helpers</Namespace>
<Namespace>WeihanLi.Common.Http</Namespace>
<Namespace>WeihanLi.Extensions</Namespace>
<Namespace>Microsoft.ML.OnnxRuntimeGenAI</Namespace>
</Query>
Console.WriteLine("--------------------");
<Query Kind="Program">
<NuGetReference>WeihanLi.Common</NuGetReference>
<Namespace>WeihanLi.Common</Namespace>
<Namespace>WeihanLi.Common.Helpers</Namespace>
<Namespace>WeihanLi.Common.Http</Namespace>
<Namespace>WeihanLi.Extensions</Namespace>
</Query>
void Main()
{
Console.WriteLine("Hello World");
}
// You can define other methods, fields, classes and namespaces here
<Query Kind="Expression">
<NuGetReference>WeihanLi.Common</NuGetReference>
<Namespace>WeihanLi.Common</Namespace>
<Namespace>WeihanLi.Common.Helpers</Namespace>
<Namespace>WeihanLi.Common.Http</Namespace>
<Namespace>WeihanLi.Extensions</Namespace>
</Query>
123 + 321
netpad sample
1fbfda72-351f-4dfe-b163-657e3e05f9bc
{"config":{"kind":"Program","targetFrameworkVersion":"DotNet8","optimizationLevel":"Debug","useAspNet":false,"namespaces":["System","System.Collections","System.Collections.Generic","System.Data","System.Diagnostics","System.IO","System.Linq","System.Linq.Expressions","System.Net.Http","System.Reflection","System.Text","System.Text.RegularExpressions","System.Threading","System.Threading.Tasks","System.Xml","System.Xml.Linq","System.Xml.XPath","System.Text.Json","System.Text.Json.Nodes"],"references":[{"discriminator":"PackageReference","packageId":"WeihanLi.Common","version":"1.0.66","title":"WeihanLi.Common"}]},"dataConnection":null}
#Code
using WeihanLi.Common;
var filePath = @"blog-articles.json";
using var fs = File.OpenRead(filePath);
var services = Guard.NotNull(JsonSerializer.Deserialize<JsonObject[]>(fs))
.Select(o => o["articleId"]?.GetValue<int>())
.ToHashSet();
Console.WriteLine(string.Join(",", services.Select(s=> $"{s}")));
ScriptSerializer: https://github.com/tareqimbasher/NetPad/blob/b48529cab236d8607bb67ee211154239e72de757/src/Apps/NetPad.Apps.Common/Scripts/ScriptSerializer.cs#L10
supported in 0.22.0
add support for
linqpad
/netpad
script execute