Go Back   ZeroC Forums > Comments

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 09-27-2005
DeepDiver's Avatar
DeepDiver DeepDiver is offline
Registered User
 
Name: Thomas Müller
Organization: Freelance Software Developer
Project: Project depend on Customers
 
Join Date: Nov 2004
Location: Munich, Bavaria, Germany
Posts: 100
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.
__________________
Thomas Müller, Freelance Software Developer
My profil on www.freelancermap.de
Projects depend on customers

Last edited by DeepDiver : 09-27-2005 at 11:27 AM.
Reply With Quote
  #2 (permalink)  
Old 09-28-2005
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 909
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.

Quote:
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.
Reply With Quote
  #3 (permalink)  
Old 09-29-2005
DeepDiver's Avatar
DeepDiver DeepDiver is offline
Registered User
 
Name: Thomas Müller
Organization: Freelance Software Developer
Project: Project depend on Customers
 
Join Date: Nov 2004
Location: Munich, Bavaria, Germany
Posts: 100
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
Projects depend on customers
Reply With Quote
  #4 (permalink)  
Old 09-29-2005
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 909
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.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Asynchronous Method Invocation Samples pradeep Help Center 1 11-23-2006 05:55 AM
NoObjectFactoryException for method-less class borax00 Help Center 7 07-20-2006 06:07 AM
No ice_collocationOptimization method in python wgwolf Help Center 5 12-06-2005 02:40 PM
Method tokens: strings vs. indices JohnBates Comments 1 05-06-2003 08:44 PM


All times are GMT -4. The time now is 08:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.