This repository was archived by the owner on Apr 27, 2026. It is now read-only.
Repository navigation
Get all defined Variables in the current context programatically? #3044
Unanswered
efficienthacks
asked this question in
Q&A
Replies: 1 comment
|
Here's an example of the API used to query for which variables are declared in a given kernel: using Microsoft.DotNet.Interactive;
using Microsoft.DotNet.Interactive.Commands;
var result = await Kernel.Root.SendAsync(new RequestValueInfos("csharp"));
result.EventsThe To get the value of a specific variable you can use the var result = await Kernel.Root.SendAsync(new RequestValue("x", mimeType: "application/json", targetKernelName: "csharp"));
result.EventsIt's also worth noting that the |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
Is there any way to get the Variables programatically (i.e. in a C# cell)? (I know you see it in the Polyglot Notebook: Variables pane)
I want to run a different code path depending on whether a variable exists in the Notebook.
Thanks
All reactions