LocalIdCollection.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / LocalIdCollection.cs / 1 / LocalIdCollection.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.InfoCards
{ 
    using System;
    using System.Collections.Generic; 
 
    //
    // Summary: 
    //  The collection of LocalIds used during search operations.
    //
    // Remarks:
    //  This is for internal store use only. 
    //
    internal class LocalIdCollection 
    { 
        SortedList m_inner;
 
        public LocalIdCollection()
        {
            m_inner = new SortedList();
        } 

 
 

        // 
        // Summary:
        //  Adds an item to the list to the correct spot in the list.
        // Parameters:
        //  item:       The value to add to the list 
        //
        public void Add( int item ) 
        { 
            if( !m_inner.ContainsKey( item ) )
            { 
                m_inner.Add( item, item );
            }

        } 

 
        public void Clear() 
        {
            m_inner.Clear(); 
        }

        public int Count
        { 
            get { return m_inner.Count; }
        } 
 

 
        //
        // Summary:
        //  Filters the current list of localIds,
        // 
        // Remarks:
        //  Opearation is O(n) 
        // 
        // Parameters:
        //  itemsToKeep:    the list of items not to remove from the list. 
        //
        //
        public void Filter( LocalIdCollection itemsToKeep )
        { 
            int count = m_inner.Count;
            for( int i = count - 1; i >=0; i-- ) 
            { 
                if( !itemsToKeep.m_inner.ContainsKey( m_inner.Keys[i] )  )
                { 
                    m_inner.RemoveAt( i );
                }
            }
 

        } 
 
        public IList Keys
        { 
            get { return m_inner.Keys; }
        }

        // 

 
 

    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK