Access salesforce API version of a class in Apex
You can perform a SoQL query on the ApexClass
object:
ApexClass apexClass = [
SELECT ApiVersion
FROM ApexClass
WHERE Name = 'MyClassName'
];
System.debug(apexClass.ApiVersion);
//27.0
Don't worry, the records will be visible without needing SeeAllData=true