The safe check is using:
if (Class.GetHandle (typeof (EKReminder)) != IntPtr.Zero) {
// we know we can use EKReminder
}
However it's a bit costly because it involves reflection. The Objective-C name can differ from the .NET name (e.g. NSURL
versus NSUrl
and that can only be found by reflecting the Register
attribute).
If you know the Objective-C name then you can use the, non-type safe, overload to skip reflection. E.g.
// checking for NSUrl would not work
if (Class.GetHandle ("NSURL") != IntPtr.Zero) {
// we know we can use NSUrl
}
Again (and to generalize my answer for everyone) it's often best/easier/faster to use the iOS version to do runtime checks for non-hardware features.
if (UIDevice.CurrentDevice.CheckSystemVersion (5,0)) {
// we know feature X was added in 5.0
}