Oh, and to answer your actual question.
What you are after is called 'adding a shared parameter'.
Try it out once from the UI. Read the help to find out how.
A complete programmatic implementation is offered many times over by The Building Coder, e.g. here in the ExportCncFab CNC fabrication sample:
http://thebuildingcoder.typepad.com/blog/2013/12/driving-cnc-fabrication-and-shared-parameters.html
Cheers,
Jeremy