Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / FreeIndexList.cs / 1 / FreeIndexList.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.Collections; using System.Collections.Generic; using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // Summary: // Manages the list of Free LocalIds in an IndexDataBuffer class // // Remarks: // This is for internal file store use only. // internal class FreeIndexList { Dictionary< Int32, Int32 > m_list; // // Summary: // Creates an instance of FreeIndexList // Parameters: // size: the initial size for the internal Int32 array // public FreeIndexList( int size ) { if( size <= 0 ) { //"value must be > 0" throw IDT.ThrowHelperError( new ArgumentOutOfRangeException( "size", size, SR.GetString( SR.StoreFreeListSizeOutOfRange ) ) ); } m_list = new Dictionary( size ); } // // Summary: // Determins if the specified LocalId is current in the FreeList // // Remarks: // // Parameters: // value: the value of the LocalId to test. // public bool Contains( Int32 value ) { if( value <= 0 ) { //"value must be > 0" throw IDT.ThrowHelperError( new ArgumentOutOfRangeException( "value", value, SR.GetString( SR.StoreFreeListValueOutOfRange ) ) ); } return m_list.ContainsKey( value ); } // // Summary: // Adds a LocalId to the free list // // Remarks: // // Parameters: // value: the value to add to the free list // public void Put( Int32 value ) { if( value <= 0 ) { throw IDT.ThrowHelperError( new ArgumentOutOfRangeException( "value", value, SR.GetString( SR.StoreFreeListValueOutOfRange ) ) ); } m_list.Add( value, value ); } // // Summary: // Get the first free index id available. // // Returns: // The first free item available. // // // Review: A straight hash table would be better here. // public Int32 GetNext() { int next = -1; if( m_list.Count > 0 ) { using( IEnumerator enumerator = m_list.Keys.GetEnumerator() ) { enumerator.MoveNext(); next = enumerator.Current; } m_list.Remove( next ); } return next; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ScriptResourceAttribute.cs
- RemotingConfigParser.cs
- LinkArea.cs
- EditorAttribute.cs
- SupportingTokenProviderSpecification.cs
- Tuple.cs
- M3DUtil.cs
- CodeTypeParameterCollection.cs
- MatchAttribute.cs
- XmlNamespaceDeclarationsAttribute.cs
- OutputCacheProfile.cs
- SafeReversePInvokeHandle.cs
- CheckBoxFlatAdapter.cs
- rsa.cs
- ValidatingReaderNodeData.cs
- PackageFilter.cs
- MultipartContentParser.cs
- GridViewColumnHeaderAutomationPeer.cs
- RadioButton.cs
- ViewEventArgs.cs
- ImpersonateTokenRef.cs
- __Filters.cs
- ProcessHostFactoryHelper.cs
- DefaultValueTypeConverter.cs
- ThreadNeutralSemaphore.cs
- _AutoWebProxyScriptHelper.cs
- ConstraintConverter.cs
- QilTypeChecker.cs
- StatusBarAutomationPeer.cs
- XsdBuildProvider.cs
- BitmapSizeOptions.cs
- WindowsGraphics.cs
- ApplicationContext.cs
- ExportOptions.cs
- ZipArchive.cs
- UrlMapping.cs
- UnsafeNativeMethods.cs
- PassportAuthentication.cs
- ScriptingRoleServiceSection.cs
- ActivityUtilities.cs
- TransactionContextValidator.cs
- GenericWebPart.cs
- ToolboxItemCollection.cs
- TemplateBamlRecordReader.cs
- KernelTypeValidation.cs
- HttpCachePolicy.cs
- TemplateBamlRecordReader.cs
- XmlDictionaryReaderQuotasElement.cs
- SimpleWebHandlerParser.cs
- PeerApplication.cs
- Point3DValueSerializer.cs
- XPathChildIterator.cs
- ScriptingRoleServiceSection.cs
- HTTPNotFoundHandler.cs
- HwndHost.cs
- NativeMethods.cs
- AuthenticationModuleElementCollection.cs
- CodeAttributeArgumentCollection.cs
- XmlBindingWorker.cs
- BCLDebug.cs
- TransformCollection.cs
- PersistenceProviderDirectory.cs
- Int32Animation.cs
- GridEntry.cs
- XmlHierarchyData.cs
- MatrixTransform.cs
- Label.cs
- MenuItem.cs
- AgileSafeNativeMemoryHandle.cs
- HtmlInputFile.cs
- ScriptingWebServicesSectionGroup.cs
- DictionaryManager.cs
- SecurityHeader.cs
- ConstraintStruct.cs
- FloaterBaseParagraph.cs
- LayoutSettings.cs
- Win32.cs
- InternalPolicyElement.cs
- CodeMethodReturnStatement.cs
- XmlRootAttribute.cs
- RegexCode.cs
- TaiwanLunisolarCalendar.cs
- NamespaceDecl.cs
- CssClassPropertyAttribute.cs
- SkewTransform.cs
- GridViewRowCollection.cs
- ProcessHostServerConfig.cs
- BitmapEffectDrawing.cs
- XmlSchemaValidator.cs
- StylusButton.cs
- SetterBase.cs
- MaxSessionCountExceededException.cs
- ConfigurationLocation.cs
- TypeGeneratedEventArgs.cs
- Formatter.cs
- ReliableSessionElement.cs
- DocumentApplicationJournalEntry.cs
- OwnerDrawPropertyBag.cs
- DbMetaDataCollectionNames.cs
- ShaderRenderModeValidation.cs