Click here to Skip to main content
15,905,877 members
Home / Discussions / C#
   

C#

 
QuestionHow does one programatically arrange Outlook Tasks by category? Pin
euroazn7-Jul-10 4:24
euroazn7-Jul-10 4:24 
QuestionSeagull Bartender Application Pin
Hum Dum7-Jul-10 0:15
Hum Dum7-Jul-10 0:15 
AnswerRe: Seagull Bartender Application Pin
Pete O'Hanlon7-Jul-10 0:23
mvePete O'Hanlon7-Jul-10 0:23 
GeneralRe: Seagull Bartender Application Pin
Hum Dum7-Jul-10 0:55
Hum Dum7-Jul-10 0:55 
GeneralRe: Seagull Bartender Application Pin
Pete O'Hanlon7-Jul-10 1:37
mvePete O'Hanlon7-Jul-10 1:37 
AnswerRe: Seagull Bartender Application Pin
Abhinav S7-Jul-10 1:24
Abhinav S7-Jul-10 1:24 
GeneralRe: Seagull Bartender Application Pin
Hum Dum7-Jul-10 1:33
Hum Dum7-Jul-10 1:33 
GeneralRe: Seagull Bartender Application Pin
Abhinav S7-Jul-10 1:50
Abhinav S7-Jul-10 1:50 
AnswerRe: Seagull Bartender Application Pin
R. Giskard Reventlov7-Jul-10 2:15
R. Giskard Reventlov7-Jul-10 2:15 
QuestionSendMessage to control with non-fixed ControlID Pin
LordZoster7-Jul-10 0:08
LordZoster7-Jul-10 0:08 
AnswerRe: SendMessage with variable ControlID Pin
freakyit7-Jul-10 1:11
freakyit7-Jul-10 1:11 
GeneralRe: SendMessage with variable ControlID Pin
LordZoster7-Jul-10 1:23
LordZoster7-Jul-10 1:23 
GeneralRe: SendMessage with variable ControlID Pin
Eddy Vluggen7-Jul-10 3:45
professionalEddy Vluggen7-Jul-10 3:45 
QuestionForeign key UniqueIdentifier Pin
tek 20096-Jul-10 23:59
tek 20096-Jul-10 23:59 
AnswerRe: Foreign key UniqueIdentifier Pin
PIEBALDconsult7-Jul-10 3:22
mvePIEBALDconsult7-Jul-10 3:22 
AnswerRe: Foreign key UniqueIdentifier Pin
tek 20097-Jul-10 4:19
tek 20097-Jul-10 4:19 
AnswerRe: Foreign key UniqueIdentifier Pin
Bernhard Hiller7-Jul-10 3:57
Bernhard Hiller7-Jul-10 3:57 
QuestionHelp! URGENT Pin
Ice_Freez056-Jul-10 22:44
Ice_Freez056-Jul-10 22:44 
AnswerSuggestion PinPopular
DaveyM696-Jul-10 22:53
professionalDaveyM696-Jul-10 22:53 
GeneralRe: Suggestion Pin
Ice_Freez057-Jul-10 15:23
Ice_Freez057-Jul-10 15:23 
QuestionCollection remove Pin
MayukhSen6-Jul-10 22:34
MayukhSen6-Jul-10 22:34 
AnswerRe: Collection remove Pin
Dave Kreskowiak7-Jul-10 1:37
mveDave Kreskowiak7-Jul-10 1:37 
montosen wrote:
public void Clear(T item) { foreach (T it in base.Items) { if(it.Equals(item)) base.Remove(item); } }


You cannot remove an item from a collection while enumerating over the collection with a foreach. Youd would have to use an index into the collection instead.

Also, the name you picked for this method, "Clear", would tell me that the method removes all items from the collection, not just a single element. "Remove" would be a better choice.

Why are you even implementing this Clear (Remove) method when the base Collection class already implements it?

A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008
But no longer in 2009...




GeneralRe: Collection remove Pin
MayukhSen7-Jul-10 2:02
MayukhSen7-Jul-10 2:02 
GeneralRe: Collection remove Pin
Pete O'Hanlon7-Jul-10 2:38
mvePete O'Hanlon7-Jul-10 2:38 
QuestionRemote desktop server/client Pin
Sajjad Izadi6-Jul-10 21:05
Sajjad Izadi6-Jul-10 21:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.