0

I have an NSObject which might be an NSDecimal or NSDecimalNumber. If it is either, I'd like to convert it to a C# decimal value. How can I do this?

        if (o is NSDecimalNumber) {
            var dn = (NSDecimalNumber)o;
            return (decimal)(Somehow(dn));              
        }

        if (o is NSDecimal) {
            var d = (NSDecimal)o;
            return (decimal)(Somehow(d));
        }
tofutim
  • 22,664
  • 20
  • 87
  • 148

1 Answers1

0
        if (o is NSDecimalNumber || o is NSDecimal) {
            return decimal.Parse (o.ToString (), CultureInfo.InvariantCulture);
        }
tofutim
  • 22,664
  • 20
  • 87
  • 148