Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Pool.cs / 1305376 / Pool.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel { // see SynchronizedPoolfor a threadsafe implementation class Pool where T : class { T[] items; int count; public Pool(int maxCount) { items = new T[maxCount]; } public int Count { get { return count; } } public T Take() { if (count > 0) { T item = items[--count]; items[count] = null; return item; } else { return null; } } public bool Return(T item) { if (count < items.Length) { items[count++] = item; return true; } else { return false; } } public void Clear() { for (int i = 0; i < count; i++) items[i] = null; count = 0; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IdentityModel { // see SynchronizedPool for a threadsafe implementation class Pool where T : class { T[] items; int count; public Pool(int maxCount) { items = new T[maxCount]; } public int Count { get { return count; } } public T Take() { if (count > 0) { T item = items[--count]; items[count] = null; return item; } else { return null; } } public bool Return(T item) { if (count < items.Length) { items[count++] = item; return true; } else { return false; } } public void Clear() { for (int i = 0; i < count; i++) items[i] = null; count = 0; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LogicalExpr.cs
- InputReportEventArgs.cs
- SqlDataSourceWizardForm.cs
- FilterableAttribute.cs
- WindowAutomationPeer.cs
- XmlSchemaInfo.cs
- TextBoxView.cs
- GlyphElement.cs
- TreeSet.cs
- ZipIOBlockManager.cs
- XmlUrlResolver.cs
- XmlNamespaceMapping.cs
- SystemMulticastIPAddressInformation.cs
- _SingleItemRequestCache.cs
- PeerTransportBindingElement.cs
- Stream.cs
- RequestCacheValidator.cs
- ServiceRouteHandler.cs
- Point4DValueSerializer.cs
- WebPermission.cs
- Lease.cs
- FolderNameEditor.cs
- ping.cs
- UnmanagedBitmapWrapper.cs
- ToolboxItem.cs
- GeometryModel3D.cs
- ReferentialConstraintRoleElement.cs
- XmlDictionary.cs
- StylusDevice.cs
- ItemCollection.cs
- RevocationPoint.cs
- HuffCodec.cs
- SecurityTokenAuthenticator.cs
- XmlMtomReader.cs
- Int16Animation.cs
- WebUtil.cs
- PolyLineSegment.cs
- MsmqOutputMessage.cs
- Vector.cs
- TypeUtil.cs
- WorkflowApplicationCompletedException.cs
- XmlSchemaSimpleContentExtension.cs
- XPathAncestorIterator.cs
- XmlAnyElementAttributes.cs
- HashHelper.cs
- TypeGeneratedEventArgs.cs
- FilteredXmlReader.cs
- DocumentGrid.cs
- XmlWrappingReader.cs
- GeometryHitTestResult.cs
- ConfigurationValues.cs
- Attributes.cs
- ScaleTransform3D.cs
- KnownTypesProvider.cs
- TimeZone.cs
- ObjectDisposedException.cs
- StringCollectionEditor.cs
- AdjustableArrowCap.cs
- HandleRef.cs
- ToolStripStatusLabel.cs
- MimeTypePropertyAttribute.cs
- SessionParameter.cs
- OrthographicCamera.cs
- LogArchiveSnapshot.cs
- XmlSchemaSimpleTypeList.cs
- CompilerGeneratedAttribute.cs
- DataTemplateSelector.cs
- ReflectionServiceProvider.cs
- LoginViewDesigner.cs
- SerializerWriterEventHandlers.cs
- Win32KeyboardDevice.cs
- CodeObjectCreateExpression.cs
- BackStopAuthenticationModule.cs
- MarshalDirectiveException.cs
- SrgsItemList.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- HttpModuleActionCollection.cs
- BindingSource.cs
- Filter.cs
- ContextMarshalException.cs
- TreeNode.cs
- ToolStripPanelRow.cs
- PrintDocument.cs
- EmptyQuery.cs
- ButtonBase.cs
- PublisherMembershipCondition.cs
- SqlNode.cs
- VirtualPathProvider.cs
- GACIdentityPermission.cs
- TypedDataSourceCodeGenerator.cs
- IBuiltInEvidence.cs
- DesignerDataTable.cs
- AsyncCompletedEventArgs.cs
- SqlDataSourceEnumerator.cs
- SortQuery.cs
- ConsumerConnectionPointCollection.cs
- FixedTextContainer.cs
- ProxyHelper.cs
- OleDbStruct.cs
- DispatcherEventArgs.cs