Method AddRange takes IEnumerable collection it makes perfect sense since we want to add second collection to our first list. http://msdn.microsoft.com/en-us/library/z883w3dc%28v=vs.80%29.aspx[^]
But when you want to remove some items from collection that are in second collection (scenarion 2 grids with items and one bucket of possibilities for them, and cannot have shared items, available grid and items selected by user grid), there is RemoveRange method, right? No this method takes 2 ints http://msdn.microsoft.com/en-US/library/y33yd2b5%28v=vs.80%29.aspx[^]. Odd.
RemoveAll? This for instance takes predicate for items. http://msdn.microsoft.com/en-US/library/wdka673a%28v=vs.80%29.aspx[^]So why this is called RemoveAll? Since it's takes predicate as Where takes why this is not called RemoveWhere? From RemoveAll I would expect behavior like Clear method, but we don't need another one like that.
Method Remove takes item and removes it from collection. So why there is not method that takes range? How many times you have to remove items by range of indexes from collection (RemoveRange)? It would have to be ordered list to make it usable at some point since when you get index and number of items to remove you have to order and iterate it and since you do that why not just remove those items already? So in the end I using AddRange and extension method RemoveRange that iterates and calls Remove on second collection. Am I allone on that?
Yes/no. With a large framework, there's bound to be some inconsistencies.
Yes, it would help if we could deduce the name of the method we want to call, based on fixed patterns. No, I don't see it happening.
As for the range, I'd expect two ints, as the indexes are a good way to define a range. That's a bit harder to do with an IEnumerable.
RemoveWhere(thisconditionistrue) or RemoveAll(thisconditionistrue); yes, your version sounds better, but it'll be hard to convince MS to change it. Especially after it's being used already in a lot of sourcecode.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
Well, first of all you'll need hardware capable of receiving GPS data. Then you'll need to write some code to get this data. Finally, you need to learn how to say please; my first temptation was just to write "no". I don't work for you and you aren't a client, so I don't take well to orders from you.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
Hello, when we move the scroll bar of a program we get this exception. I think its some thing to do with Index was out of range? Is this the correct section to post in? I'm using Windows 7 64 bit if that helps. Thank you.
************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.ArrayList.get_Item(Int32 index)
at Network_Design_Tool.Network.GetLineType(Int32 index)
at Network_Design_Tool.MainForm.utilSlackParamBar_Scroll(Object sender, EventArgs e)
at System.Windows.Forms.TrackBar.OnScroll(EventArgs e)
at System.Windows.Forms.TrackBar.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
If you expect people to help you then try responding to some of the questions that have been posted. If you think people are going to download some vaguely identified piece of code from the internet, build it and debug it on your behalf, then I'm afraid you are going to be disappointed.
One of these days I'm going to think of a really clever signature.