سؤال

I am trying to compile a Xamarin.Mac project with Monodevelop+Monomac (3.0.5 from source).

I changed the reference from XamMac to MonoMac, and everything seems to be fine except this:

Error CS0019: Operator '==' cannot be applied to operands of type 'MonoMac.Foundation.NSObject' and 'string' (CS0019)

The error occurs at a line if (tableColumn.Identifier == "Name") where tableColumn is a NSTableColumn.

Can I make this compile without modifying the code?
Or if I must modify the code, what is the best practice in this case?

هل كانت مفيدة؟

المحلول

surely....

 if (tableColumn.Identifier.Equals("Name"))

would be better?

نصائح أخرى

XamarinMac most likely has operator for == between NSString/NSObject and string. Either modify MonoMac source code to add the operator (nice chance to contribute to the community edition) or change your code to compare NSString("Name") instead of string.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top