The Artima Developer Community
Sponsored Link

.NET Buzz Forum
What's wrong with this code - #6

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Gunnerson

Posts: 1006
Nickname: ericgu
Registered: Aug, 2003

Eric Gunnerson is a program manager on the Visual C# team
What's wrong with this code - #6 Posted: Apr 22, 2005 11:52 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Eric Gunnerson.
Original Post: What's wrong with this code - #6
Feed Title: Eric Gunnerson's C# Compendium
Feed URL: /msdnerror.htm?aspxerrorpath=/ericgu/Rss.aspx
Feed Description: Eric comments on C#, programming and dotnet in general, and the aerodynamic characteristics of the red-nosed flying squirrel of the Lesser Antilles
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Eric Gunnerson
Latest Posts From Eric Gunnerson's C# Compendium

Advertisement

After a long hiatus, here's the next entry in my not-really-regular-enough-to-honestly-be-called-periodic-(though-I-try-to-keep-up-a-somewhat-reasonable-schedule-I-don't-seem-to-keep-it-since-I'm-lazy-are-you-still-reading-this)-series about C# code.

Anyway, here's some code that I've seen a fair bit, and written myself:

 class Notifier

{
   ArrayList items = new ArrayList();
   public void Add(object o) {
      lock (this) {
         items.Add(o);
      }
   }
}
 
This code will work fine, but it has a latent issue. What is the issue, and how should it be addressed?

Read: What's wrong with this code - #6

Topic: ASP.NET 2.0 Beta 2 Quickstarts are online Previous Topic   Next Topic Topic: So what about Refactor! Pro?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use