The easiest way to do this is to call System.Environment.Version as this returns the version number of the CLR that is executing the code. However, the version number alone doesn't mean much unless you can relate this is a specific release of the .NET Compact Framework. To aid that, here's a table of the releases and version numbers that I'm aware of:
And here's the data in XML so that you can use it in your own applications: VersionMap.xml (1.1 KB)
June 25, 2008: Added .NET Compact Framework 3.5 RTM