Custom action with LinqPad Hyperlinq ()

If I execute this VB expression:

New Hyperlinq("c:\temp\test.py").Dump()

As a result, I get a clickable link that opens the file by default, i.e. runs this python file.

I wanted to instruct LinqPad to a custom Sub that will take care of the Click event.
The Hyperlinq class contains a parameter Action, but I cannot find an example of how to use this method:

public Hyperlinq(string uriOrPath);
public Hyperlinq(QueryLanguage queryLanguage, string query);
public Hyperlinq(Action action, string text);
public Hyperlinq(string uriOrPath, string text);
public Hyperlinq(QueryLanguage queryLanguage, string query, string text);
public Hyperlinq(Action action, string text, bool runOnNewThread);
internal Hyperlinq(int editorRow, int editorColumn, string text);
public override bool Equals(object obj);
public override int GetHashCode();
internal int RegisterAction();

Can anyone provide an example?
For example, I want to open a file using Notepad when I click the link in the results pane.

+4
source share
2 answers
dim h = New Hyperlinq(Function() "foo".Dump, "Click me")
h.Dump
+6
source

Here's a C # way to do the same as above

var h = new Hyperlinq(()=> {"foo".Dump();}, "Click me");
h.Dump();
+2
source

Source: https://habr.com/ru/post/1535171/


All Articles