今日は「ドットネットインタラクティブ」のような素晴らしいツールについてお話ししたいと思います。使用を開始した方法と理由を例で示し、どこから始めればよいかを簡単に説明します。
問題
, . , , . « » « » , .
, . , , , , "dotnet-interactive" notebook'a " "-""-""-"", .
notebook'a
, .net5 sdk VS Code. , ".NET Interactive Notebooks". "Preview", .
, , , . VS Code ".NET Interactive: Create new blank notebook" notebook.
:
#load "Load.fsx"
open Load
let Experiment = loadSep "2021.02.03_15.55.58_gen.sep"
F# , xml-:
#r "nuget: System.Text.Encoding.CodePages"
#r "AKIM.Protocol.dll"
open System.IO
open AKIM.Protocol
open System.Xml.Serialization
open System.Text
let loadSep path=
let deserializeXml (xml : string) =
let toBytes (x : string) = Encoding.UTF8.GetBytes x
let xmlSerializer = XmlSerializer(typeof<Experiment>)
use stream = new MemoryStream(toBytes xml)
xmlSerializer.Deserialize stream :?> Experiment
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance)
deserializeXml (File.ReadAllText(path, Encoding.GetEncoding(1251)))
nuget dto-, C#.
notebook'a c#-intaractive # f#,
#r "AKIM.Protocol.dll"
using AKIM.Protocol;
using AKIM.Protocol.Events;
using AKIM.Protocol.Events.OperatorSvn;
using AKIM.Protocol.Events.OperSb;
using AKIM.Protocol.Events.RespUnits;
using AKIM.Protocol.Events.Intruders;
using AKIM.Protocol.Events.Sens;
using AKIM.Protocol.Events.System;
#!share --from fsharp Experiment
, . ,
var allTests = Experiment.Tests.Count;
var penetrations = Experiment.Tests.Where(t => t.Events.Last() is PenetrationEvent).Count();
var nonPenetrations = Experiment.Tests.Where(t => t.Events.Last() is NonPenetEvent).Count();
var eve = Experiment.Tests.First().Events.FirstOrDefault(t => t is VisContactEvent);
Console.WriteLine(eve?.GetDescription());
Console.WriteLine($" {penetrations} {allTests}")
:
, :
#r "nuget: XPlot.Plotly"
#!share --from csharp penetrations
#!share --from csharp nonPenetrations
#!share --from csharp allTests
open XPlot.Plotly
Chart.Pie(seq {("- ",penetrations);
("",allTests- penetrations-nonPenetrations);
(" ",nonPenetrations)}) |> Chart.Show
, , (upd: XPlot.Plotly.Interactive. c# f# ( )).
?
# "*.csx" #-interactive. , . , , . markdown $$...$$. (upd: , , markdown )
, .net . : , - , F# C#, , , manage' - . , , , , , ( ).
, Arkadiy Kuznetsov, .
. notebook' VS Code.
.
.NET Interactive + ML.NETドキュメントも含まれている公式カブ
新機能f#(ビデオの冒頭でdotnet-intaractiveを使用)