ObservableCollection<T> is an IList, so it should pick up Enumerable support through IListOps, no?
From: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Jimmy Schementi Sent: Thursday, October 22, 2009 10:41 AM To: Hans Hugli; ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] Ruby and ObservableCollection Hans, For Ruby and Python specific questions, the public mailing lists are preferred. Ruby: ironruby-core@rubyforge.org<mailto:ironruby-core@rubyforge.org> Python: us...@lists.ironpython.com<mailto:us...@lists.ironpython.com> So I'm moving this to the IronRuby mailing list ... To address your question, System.Collections.ObjectModel.ObservableCollection<T> has all protected members, so if you just create an instance and try to call a method you should see this error: rb> $oc = System::Collections::ObjectModel::ObservableCollection[String].new => [] rb> $oc.insert_item "hi" System.MissingMethodException: CLR protected method `insert_item' called for []:System::Collections::ObjectModel::ObservableCollection[String]; CLR protected methods can only be called with a receiver whose class is a Ruby subclass of the class declaring the method However, if I subclass ObservableCollection and try to call methods I get an assert from RubyMethodGroupInfo.GetVisibleOverloads(CallArguments args, IList`1 overloads) and an exception: rb> class OCSubclass < System::Collections::ObjectModel::ObservableCollection[String] ... def initialize ... super ... self.insert_item "hi" ... end ... end => nil rb> $ocsub = OCSubclass.new System.ArgumentNullException: Value cannot be null. Parameter name: methods[0] Tomas, have any idea? ~js From: Hans Hugli Sent: Thursday, October 22, 2009 9:29 AM To: DLR Discussion Subject: Ruby and ObservableCollection Hi, Is ObservableCollection implemented in IronRuby? I am working with a student that can instantiate one [[ ObservableCollection[String].new ]], but calling the add method with a string results in a NullReferenceException. Please respond to me directly. I just added myself to the alias, but pending owner approval. If this is not the appropriate alias for this question, please let me know. Thank you, Hans Hugli Innovative Web team www.visitmix.com<http://www.visitmix.com> twitter.com/hanshu
_______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core