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
- XamlReader.cs
- RemotingAttributes.cs
- BitmapDownload.cs
- ThreadStaticAttribute.cs
- ResourceManager.cs
- SpnegoTokenAuthenticator.cs
- MessageSecurityTokenVersion.cs
- WaitForChangedResult.cs
- TransformedBitmap.cs
- IntSecurity.cs
- OleDbWrapper.cs
- SoapAttributeAttribute.cs
- SettingsSavedEventArgs.cs
- ModelItemDictionaryImpl.cs
- LicenseProviderAttribute.cs
- DataColumnCollection.cs
- XmlKeywords.cs
- SqlResolver.cs
- ColorConvertedBitmap.cs
- SqlOuterApplyReducer.cs
- PlaceHolder.cs
- CodeDOMProvider.cs
- EntityCollectionChangedParams.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- CqlQuery.cs
- OleStrCAMarshaler.cs
- TextSyndicationContentKindHelper.cs
- BatchParser.cs
- OdbcConnectionPoolProviderInfo.cs
- StateBag.cs
- CachedRequestParams.cs
- Native.cs
- ThicknessKeyFrameCollection.cs
- PathFigure.cs
- RtfToXamlReader.cs
- DependsOnAttribute.cs
- BinaryUtilClasses.cs
- ScriptManagerProxy.cs
- ToolBarButton.cs
- RestClientProxyHandler.cs
- TrackBar.cs
- WebPartDeleteVerb.cs
- SQLStringStorage.cs
- XmlUrlResolver.cs
- SqlExpressionNullability.cs
- FormsAuthenticationUser.cs
- CompositeDesignerAccessibleObject.cs
- XmlLoader.cs
- InvokeMethod.cs
- bidPrivateBase.cs
- Int16Storage.cs
- Tracer.cs
- VersionedStreamOwner.cs
- CompensateDesigner.cs
- AggregateNode.cs
- XmlSchemaObject.cs
- TemplatedWizardStep.cs
- Storyboard.cs
- DbProviderSpecificTypePropertyAttribute.cs
- AssociationSet.cs
- ChannelProtectionRequirements.cs
- JsonReader.cs
- InvalidDataContractException.cs
- WindowsListViewItem.cs
- GlyphCache.cs
- ActivityValidationServices.cs
- RepeaterCommandEventArgs.cs
- ContainerSelectorActiveEvent.cs
- DictionaryBase.cs
- EventDescriptor.cs
- IsolatedStorage.cs
- SafeTimerHandle.cs
- streamingZipPartStream.cs
- EventEntry.cs
- ActivityDefaults.cs
- ColumnPropertiesGroup.cs
- ControlParameter.cs
- HotSpotCollectionEditor.cs
- AuthorizationRuleCollection.cs
- XMLDiffLoader.cs
- InheritanceAttribute.cs
- WpfSharedXamlSchemaContext.cs
- GradientStopCollection.cs
- PermissionAttributes.cs
- UdpSocket.cs
- IndentedTextWriter.cs
- StaticExtensionConverter.cs
- TypeUsageBuilder.cs
- DateTimeUtil.cs
- RoutingEndpointTrait.cs
- UnmanagedMemoryStream.cs
- ResponseBodyWriter.cs
- EqualityComparer.cs
- TypeConstant.cs
- EventEntry.cs
- HtmlTableCell.cs
- TemplatedMailWebEventProvider.cs
- EncoderExceptionFallback.cs
- WebPartChrome.cs
- InternalConfigRoot.cs