Bug 208 - Missing Support For NSMutableArray
Summary: Missing Support For NSMutableArray
Alias: None
Product: MonoMac
Classification: Desktop
Component: Bindings ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2011-08-05 17:18 UTC by Adam Johnson
Modified: 2011-08-08 18:50 UTC (History)
2 users (show)

Tags: NSMutableArrary
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Adam Johnson 2011-08-05 17:18:13 UTC
It would be a huge benefit to include support for NSMutableArray. It includes the ability to remove the entire selection of an arrary without having to loop through the entire thing. I hope I am not missing where it is already included. If there is any way I can assist please let me know.
Comment 1 Miguel de Icaza [MSFT] 2011-08-05 17:21:17 UTC
NSMutableArray was not bound on purpose, since you should be using native C# arrays instead.

This is a design decision.   There needs to be a very compelling case for adding this to the public API for us to ship it.
Comment 2 Adam Johnson 2011-08-05 18:13:00 UTC
The problem arises when attempting to delete all items from an Array Controller. ((NSMutableArray)arrayController.Content).RemoveAll(); //should work.
Instead I have to do:
NSObject [] nsObject = arrayController.ArrangedObjects();
foreach (NSObject removeObject in NSObject)

I would much rather do 1 line instead of 3. I saw the NSMutableArray line in the MonoMac sample for ScriptingBridgeFinder. This line causes the solution to fail to build.
Comment 3 Miguel de Icaza [MSFT] 2011-08-08 17:52:41 UTC
Should this not be:

arrayControleler.RemoteObjects (arrayController.ArrangedObjects ());
Comment 4 Adam Johnson 2011-08-08 18:37:52 UTC
Unfortunately NSArrayController does not have a RemoveObjects() method. I tried arrayController.RemoveSelectedObjects(NSObject[]) but that only removes the selected object and not the entire list.
Comment 5 Adam Johnson 2011-08-08 18:50:09 UTC
arrayController.Remove() will accept an array of objects. This will work instead of having to implement NSMutableArray. 
The new code that works is:
I am closing as wont fix since NSMutableArray is not needed and wont be included per the initial response. Thanks for the prompt responses!