keyedcollection

Fastest way to copy a KeyedCollection

I'm working on a C# object copy constructor, part of which involves copying the contents of a KeyedCollection into a new KeyedCollection. This is what I have implemented currently: class MyKeyedCollection : KeyedCollection<uint, DataObject> { protected override uint GetKeyForItem( DataObject do ) { return do.Key; } }...

Keyed ObservableCollection in Silverlight

Hi everybody, I want to implement a keyed observable collection in Silverlight, that will store unique objects based on a property called Name. One way of doing it is to use the ObservableCollectionEx (samples in another stackoverflow post) class which subscribes to all PropertyChanged events on the contained elemens and check to see if...

Adding and retrieving from a KeyedCollection

I want to use a KeyedCollection to store a class against a string key value. I have the following code: public class MyClass { public string Key; public string Test; } public class MyCollection : KeyedCollection<string, MyClass> { public MyCollection() : base() { } protected override String GetKeyForItem(MyCla...

LINQ Query with OrderBy in object that inherits from KeyedCollection not using IEnumerableOf

I have this class declaration: Public Class clsColection(Of T) Inherits System.Collections.ObjectModel.KeyedCollection(Of String, T) Implements System.Collections.IEnumerable Implements System.Collections.Generic.IEnumerable(Of T) ... Public Shadows Function GetEnumerator() As System.Collections.Generic.IEnumerator(Of T...