The AFElement.Version property returns AFVersion, while the AFVersion.VersionID property returns a Guid. The error message indicates that you are trying to assign a Guid (VersionID) to a variable with type AFVersion. The following code will not throw an error:
AFVersion afVersion = myAFElement.Version; Guid versionId = afVersion.VersionID;
More importantly, what are you trying to achieve by comparing the versions? Consider finding a particular version by query date using the AFVersion.FindVersion method. You can also navigate back and forth to different versions using the AFVersion.PreviousVersion, NextVersion or LatestVersion methods. If you just want to see if there are multiple versions for this element, you can look at the AFVersion.HasMultipleVersions property.