- Introduction
- An XML Node Representing a Simple Macro Language
- Implementing the Section Handler
- Reconstituting the Object
- Summary
Reconstituting the Object
To reconstitute our startup macro, we call the static method
Configuration
Settings.GetConfig and pass the name of the section we
want, in this instance "startupMacro". GetConfig
calls Create, which returns an object, so we will need to cast that to
the type we know it to be, StartupMacro. The next step is to invoke the
Run method. If everything is working correctly, you should see the
About string output and the application should terminate.
This code isn't too advanced; if you have problems, debug in the usual way. You can test the StartupMacro directly by creating an instance. If that works, add a breakpoint to the MacroSectionHandler.Create method and check for errors. A final place to look for omissions or errors is in the app.config file itself.