Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Serialization / System / Runtime / Serialization / HybridObjectCache.cs / 1305376 / HybridObjectCache.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Runtime.Serialization { using System; using System.Xml; using System.Collections.Generic; internal class HybridObjectCache { DictionaryobjectDictionary; Dictionary referencedObjectDictionary; internal HybridObjectCache() { } internal void Add(string id, object obj) { if (objectDictionary == null) objectDictionary = new Dictionary (); object existingObject; if (objectDictionary.TryGetValue(id, out existingObject)) throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.GetString(SR.MultipleIdDefinition, id))); objectDictionary.Add(id, obj); } internal void Remove(string id) { if (objectDictionary != null) objectDictionary.Remove(id); } internal object GetObject(string id) { if (referencedObjectDictionary == null) { referencedObjectDictionary = new Dictionary (); referencedObjectDictionary.Add(id, null); } else if (!referencedObjectDictionary.ContainsKey(id)) { referencedObjectDictionary.Add(id, null); } if (objectDictionary != null) { object obj; objectDictionary.TryGetValue(id, out obj); return obj; } return null; } internal bool IsObjectReferenced(string id) { if (referencedObjectDictionary != null) { return referencedObjectDictionary.ContainsKey(id); } return false; } } } // 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
- URLEditor.cs
- LinqToSqlWrapper.cs
- BrowserTree.cs
- DropShadowEffect.cs
- SortedList.cs
- SmiContext.cs
- NeedSkipTokenVisitor.cs
- DataListItemEventArgs.cs
- WindowsPen.cs
- ContainerControl.cs
- DefaultMergeHelper.cs
- EntityDataSourceWrapper.cs
- CacheDependency.cs
- MostlySingletonList.cs
- PieceDirectory.cs
- EventLogger.cs
- Privilege.cs
- LongSumAggregationOperator.cs
- ProgressChangedEventArgs.cs
- ErrorFormatterPage.cs
- OdbcParameterCollection.cs
- SafeEventLogReadHandle.cs
- _KerberosClient.cs
- HtmlInputImage.cs
- DragDrop.cs
- SurrogateDataContract.cs
- AccessText.cs
- CodeTypeMemberCollection.cs
- Compiler.cs
- FlatButtonAppearance.cs
- XmlTextWriter.cs
- SqlUtils.cs
- LoginUtil.cs
- SqlDependency.cs
- Scene3D.cs
- NodeFunctions.cs
- ChildDocumentBlock.cs
- InvalidPrinterException.cs
- SchemaMerger.cs
- XPathParser.cs
- Columns.cs
- RichTextBox.cs
- GatewayDefinition.cs
- MetaTable.cs
- ActivityExecutorDelegateInfo.cs
- FixedPage.cs
- XmlObjectSerializerWriteContextComplex.cs
- CodeComment.cs
- LineVisual.cs
- GCHandleCookieTable.cs
- ScrollBarRenderer.cs
- Decorator.cs
- HandlerFactoryCache.cs
- SqlLiftWhereClauses.cs
- RawStylusActions.cs
- KeyTime.cs
- FunctionQuery.cs
- SQLString.cs
- Facet.cs
- ServiceMemoryGates.cs
- MediaPlayerState.cs
- CompilerError.cs
- IntSecurity.cs
- TextBlockAutomationPeer.cs
- CodeTypeOfExpression.cs
- TransformGroup.cs
- Validator.cs
- BoundPropertyEntry.cs
- TextSpan.cs
- StylusTouchDevice.cs
- StaticResourceExtension.cs
- DataGridItem.cs
- RijndaelManaged.cs
- AsyncStreamReader.cs
- _SpnDictionary.cs
- TdsRecordBufferSetter.cs
- DataServiceRequest.cs
- XmlExpressionDumper.cs
- EntityDataSourceConfigureObjectContext.cs
- RightsManagementInformation.cs
- PersistChildrenAttribute.cs
- LabelDesigner.cs
- TextParaLineResult.cs
- HttpCacheVary.cs
- Schema.cs
- HighlightComponent.cs
- ToolStripDropDownDesigner.cs
- DesignerVerb.cs
- NotifyIcon.cs
- Compiler.cs
- ProviderSettingsCollection.cs
- SmtpNtlmAuthenticationModule.cs
- AsymmetricSignatureDeformatter.cs
- WinCategoryAttribute.cs
- CodeCatchClause.cs
- SkinIDTypeConverter.cs
- TextContainer.cs
- CodeMemberEvent.cs
- DataGridItemEventArgs.cs
- ThreadAttributes.cs