With WSSv2 (SharePoint 2003) you could get the version of SharePoint you were working with
e.g. SPGloablAdmin.Version gives you "12.0.0.6219" for WSSv3 SP1
However its now obsolete (although still works).
Does anyone know the WSSv3 (SharePoint 2007) equivalent?
You have things like SPWebService.ContentService.Version but that version number is just a timestamp and doesn't seem to relate back to build versions.