OpenHome.Songcast.MediaPlayer.CompareTo C# (CSharp) Method

CompareTo() public method

public CompareTo ( object obj ) : int
obj object
return int
        public int CompareTo(object obj)
        {
            MediaPlayer player = obj as MediaPlayer;

            if (iDescription != null && player.iDescription != null)
            {
                return (iDescription.CompareTo(player.iDescription));
            }

            return (1);
        }

Usage Example

Ejemplo n.º 1
0
        public void Add(Object aObject)
        {
            MediaPlayer add = aObject as MediaPlayer;

            int index = 0;

            foreach (MediaPlayer player in iList)
            {
                if (add.CompareTo(player) < 0)
                {
                    iList.Insert(index, add);

                    if (CollectionChanged != null)
                    {
                        CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, aObject, index));
                    }

                    return;
                }

                index++;
            }

            iList.Add(add);

            if (CollectionChanged != null)
            {
                CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, aObject));
            }
        }