Two unrelated questions...

IceAzul

Freshman
Joined
Jun 7, 2005
Messages
43
(1) How do you create the information for intellisense? (The description of variables, classes)
(2) How can you generate an error when an item is added to a custom built collection class (from an array) during a foreach loop?
Thank You
 
If you are using C# and provide xml comments (comments that begin with a ///) then the intellisense will be generated from them - this also works in VB if you are using VS 2005.

If they are adding an item you could simple throw an exception when they attempt to add an invalid item. Or are you asking something different?
 
When I make a custom collection type class (due to the fact that I needed better control over the array then inheriting from an arraylist) and create an IEnumerator class, I want an error to be thrown when an object is added while in that foreach loop, like it does by an arraylist. How can I accomplish this?
 
You could have your collection object track any open enumerators and throw an exception when something is added or removed while there are open enumerators.

You could also have the collection object raise an event when something is added/removed and have your enumerators handle the event.
 
Back
Top