ObjectList class

  • Thread starter Thread starter Richard A. Lowe
  • Start date Start date
No, there is not.

System.Collections implements lists of things (ArrayList), but the are not
"observed".

What you would need is an ArrayList that also implements IBindableList, and
this is not in the .NET Framework per se - right now.

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
 
Is there any ObjectList class in c#? I mean, a class that can keep a list
with pointers to objects. I come from Delphi background and I'm trying to
translate a sample "observer pattern" demo to C#

(pseudo code. I hope you know what I mean)

class B
{
procedure ObservedChange{}

B{ A.AddObserver(self instance, this?) }

}

class A
{
type? List
procedure AddObserver(B b);
procedure Change;
{
for i=0 to List.Count {
List.Item.ObservedChange; //{??????}
}

}
 
Hi,

you might consider using events and delegates (if it's appropriate for the
job).

Greetings,

Bram.
 
Julian,

The "equivalent" of an a Delphi TObjectList in .NET is the ArrayList. In
fact Delphi for .NET's TList is really an ArrayList. However, if you're
looking at building an observer, you might want to look at Multicast
Delegates. They are in fact an implementation of the observer pattern.
 
Back
Top