I've made a method which interacts with Fiddler in C#. The code looks like this:
public class SmartMocks
public static void SmartMock(Session oSession, string directoryPath)
After referencing the DLL in Fiddler > Options > Extensions, I add the following to the top of FiddlerScript:
And then I can call the function in FiddlerScript like this:
This works fine. However, I'd like to make SmartMock be an extension method of Fiddler.Session, so that I can use this nicer-looking syntax instead in FiddlerScript:
I'm not familiar with JScript.NET and how it handles references, so I've been having trouble adding this method to Fiddler.Session. I tried changing the code to an extension like this:
public static class SmartMocks
public static void SmartMock(this Session oSession, string directoryPath)
However, when compiling FiddlerScript, calling "oSession.SmartMock("C:\\SomeFile.txt")" gives the error "Objects of type 'Fiddler.Session' do not have such a member".
My question is:
- How do you create an extension method to a class (like Fiddler.Session) in JScript.NET?