When searching through some files using LinqPad it can be useful to print out the results as a hyperlink that will open the file in Notepad++ at a particular line number.
public static class MyExtensions
{
// Write custom extension methods here. They will be available to all queries.
private const string notePadppPath = @"C:\Program Files\Tools\Notepad++\notepad++.exe";
public static Hyperlinq CreateNotePadppHyperLink(this string filePath, int lineNumber)
{
var filelink = new Hyperlinq(() => Process.Start(notePadppPath, filePath + " -n" + lineNumber.ToString()), filePath);
return filelink;
}
}
Usage
string filePath = .... ;
filePath.CreateNotePadppHyperLink(lineNumber);
No comments:
Post a Comment