Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

(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

  • Administrators
Posted

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?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
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?
  • Leaders
Posted

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.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...