Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / IdentityModel / System / IdentityModel / Pool.cs / 1 / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ObjectDataSourceFilteringEventArgs.cs
- ScriptResourceDefinition.cs
- UnknownBitmapEncoder.cs
- ImageListUtils.cs
- UICuesEvent.cs
- ProvidePropertyAttribute.cs
- CharacterBuffer.cs
- XmlSerializationReader.cs
- LinkTarget.cs
- Image.cs
- MailBnfHelper.cs
- MergePropertyDescriptor.cs
- MimePart.cs
- MetricEntry.cs
- Error.cs
- List.cs
- TextEditorDragDrop.cs
- ipaddressinformationcollection.cs
- SortedDictionary.cs
- ObjectReaderCompiler.cs
- ContainerUtilities.cs
- _OSSOCK.cs
- ItemsControl.cs
- EFTableProvider.cs
- AdornerLayer.cs
- DbDeleteCommandTree.cs
- AsyncOperationManager.cs
- BevelBitmapEffect.cs
- PasswordRecovery.cs
- Visitor.cs
- BrowserCapabilitiesFactoryBase.cs
- URL.cs
- XPathDocumentIterator.cs
- RsaSecurityTokenAuthenticator.cs
- XmlSchemaSimpleTypeUnion.cs
- XPathPatternBuilder.cs
- WorkflowRuntimeServiceElement.cs
- XComponentModel.cs
- AudioStateChangedEventArgs.cs
- WindowsEditBoxRange.cs
- DeclarativeCatalogPart.cs
- SoapServerMethod.cs
- RegisteredHiddenField.cs
- RTLAwareMessageBox.cs
- GenericEnumConverter.cs
- BaseTemplateCodeDomTreeGenerator.cs
- DataError.cs
- GeometryDrawing.cs
- DrawingState.cs
- HttpProcessUtility.cs
- TypeUtils.cs
- FontSourceCollection.cs
- DrawingGroupDrawingContext.cs
- DiffuseMaterial.cs
- lengthconverter.cs
- Stacktrace.cs
- ErasingStroke.cs
- ObjectDataSourceView.cs
- EdmError.cs
- NumberFormatInfo.cs
- UriTemplateEquivalenceComparer.cs
- RangeExpression.cs
- RuleSettings.cs
- BasePropertyDescriptor.cs
- PerformanceCounter.cs
- RawAppCommandInputReport.cs
- SubMenuStyleCollection.cs
- DBSqlParser.cs
- Vector3D.cs
- ResXDataNode.cs
- CodeRegionDirective.cs
- PropertyValueEditor.cs
- DataListCommandEventArgs.cs
- PenThreadWorker.cs
- ObjectManager.cs
- DataFormats.cs
- MouseButtonEventArgs.cs
- PrinterResolution.cs
- PasswordBoxAutomationPeer.cs
- SafeNativeMethodsCLR.cs
- filewebrequest.cs
- XamlTreeBuilder.cs
- SetUserPreferenceRequest.cs
- TouchPoint.cs
- ChildTable.cs
- RightsManagementEncryptionTransform.cs
- ProjectedWrapper.cs
- ContentFileHelper.cs
- XsdDateTime.cs
- Trace.cs
- ControlIdConverter.cs
- ProviderSettingsCollection.cs
- _LoggingObject.cs
- FixedDSBuilder.cs
- BoundingRectTracker.cs
- XmlElement.cs
- ConfigurationSection.cs
- LinkArea.cs
- HwndSubclass.cs
- TextDataBindingHandler.cs