Results 1 to 4 of 4

Thread: Nice to have: BinarySearch and Sort method on generated collections

  1. #1
    DeepDiver's Avatar
    DeepDiver is offline Registered User
    Name: Thomas Mueller
    Organization: Freelance Software Developer
    Project: Project depend on Customers
    Join Date
    Nov 2004
    Location
    Munich, Bavaria, Germany
    Posts
    105

    Nice to have: BinarySearch and Sort method on generated collections

    hi,

    in case sequence<> is generated with the meta tag ["cs:collection"]
    it would be nice to have the BinarySearch and Sort methods available.

    the generated code will look like:
    Code:
    	public int BinarySearch(C value)
    	{
    	    return InnerList.BinarySearch(value);
    	}
    
    	public void Sort()
    	{
    	    return InnerList.Sort();
    	}
    this is actually pretty straight foreward.

    thx & cu tom


    PS: adding the contructor with parameter ICollection c would help as well.
    Last edited by DeepDiver; 09-27-2005 at 10:27 AM.
    Thomas Müller, Freelance Software Developer
    My profil on www.freelancermap.de
    My Profile on Xing
    Projects depend on customers

  2. #2
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Quote Originally Posted by DeepDiver
    in case sequence<> is generated with the meta tag ["cs:collection"]
    it would be nice to have the BinarySearch and Sort methods available.
    I don't see any problem with this, so I'll add this for the next release.

    adding the contructor with parameter ICollection c would help as well.
    I'm reluctant to add this because it would open up a hole in the type system: if I pass a collection with elements of the wrong type to this constructor, I won't be told at compile time. Instead, the constructor would have to throw an exception at run time if the elements cannot be cast to the expected element type.

    Overall, I think it's preferable to write a foreach loop explicitly to populate the collection. At least, that way, the cast is explicit and I can see what is going on in the code.

    Cheers,

    Michi.

  3. #3
    DeepDiver's Avatar
    DeepDiver is offline Registered User
    Name: Thomas Mueller
    Organization: Freelance Software Developer
    Project: Project depend on Customers
    Join Date
    Nov 2004
    Location
    Munich, Bavaria, Germany
    Posts
    105
    hi michi,

    thank you for adding this feature to the next release!

    i totally agree with you about the type safty issue.
    we will no longer have these troubles with .Net 2.0, when we can
    make use of generics.

    any plans on .Net 2.0 and generics?

    thx & take care,

    tom
    Thomas Müller, Freelance Software Developer
    My profil on www.freelancermap.de
    My Profile on Xing
    Projects depend on customers

  4. #4
    michi's Avatar
    michi is offline Registered User
    Name: Michi Henning
    Organization: Triodia Technologies
    Project: I have a passing interest in Ice :-)
    Join Date
    Feb 2003
    Location
    Brisbane, Australia
    Posts
    1,055
    Quote Originally Posted by DeepDiver
    any plans on .Net 2.0 and generics?
    Not just yet, but we will probably provide a new mapping at some point that makes use of the new features.

    Cheers,

    Michi.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to get the arguments of remote method ?
    By pinusmugo in forum Help Center
    Replies: 1
    Last Post: 10-15-2008, 09:12 AM
  2. waitForShutdown method
    By sionscone in forum Help Center
    Replies: 3
    Last Post: 10-16-2007, 06:42 AM
  3. Few features that'd be nice
    By Mike Hearn in forum Comments
    Replies: 0
    Last Post: 10-08-2007, 04:07 PM
  4. NoObjectFactoryException for method-less class
    By borax00 in forum Help Center
    Replies: 7
    Last Post: 07-20-2006, 05:07 AM
  5. No ice_collocationOptimization method in python
    By wgwolf in forum Help Center
    Replies: 5
    Last Post: 12-06-2005, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •