On May 24, 2012, at 3:15 AM, gpe wrote:
> I am using the generic ConcurrentStack in some of my code. And when using it 
> on monodroid I noticed that the method PushRange and TryPopRange do not work.

Can you elaborate? It is implemented, but I have found a bug wherein arrays of 
length 1 don't work. Use an array that holds more than one element, and it 
works:

        var s = new ConcurrentStack<int> ();
        s.PushRange (new []{5,4,3,2,1});
        int[] b = new int[3];
        int n;
        if ((n = s.TryPopRange (b)) > 0) {
                Console.WriteLine ("Popped range! n={0}; contents: {1}", n, 
string.Join (", ", b));
        }
        Console.WriteLine ("s contents: {0}", string.Join (", ", s));

The above prints:

        Popped range! n=2; contents: 1, 2, 3
        s contents: 3, 4, 5

However, if I change the length of `b` to contain 1 element, nothing is popped. 
This appears to be a bug:

        https://bugzilla.xamarin.com/show_bug.cgi?id=5304

 - Jon

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to