We have finally reached the point where we can produce an entire example. In my previous post I explained how, conceptually, this command will work. Now, here is the actual code for the command along with a lot of comments.
I have also copied and commented out the definitions for the relevant elements that we are going to create.
I hope that you fire up Visual Studio and try building this code; if you are impatient though and want to just run it, here is the dll.