Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / System.Runtime.DurableInstancing / System / Runtime / DurableInstancing / InstanceKey.cs / 1305376 / InstanceKey.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Runtime.DurableInstancing { using System.Collections.Generic; using System.Xml.Linq; [Fx.Tag.XamlVisible(false)] public class InstanceKey { static IDictionaryemptyMetadata = new ReadOnlyDictionary (new Dictionary (0)); static InstanceKey invalidKey = new InstanceKey(); readonly bool invalid; // Comparisons to Guid.Empty are too slow. InstanceKey() { this.Value = Guid.Empty; this.invalid = true; } public InstanceKey(Guid value) : this(value, null) { } public InstanceKey(Guid value, IDictionary metadata) { if (value == Guid.Empty) { throw Fx.Exception.Argument("value", SRCore.InstanceKeyRequiresValidGuid); } this.Value = value; if (metadata != null) { this.Metadata = ReadOnlyDictionary .Create(metadata); } else { this.Metadata = emptyMetadata; } } public bool IsValid { get { return !this.invalid; } } public Guid Value { get; private set; } public IDictionary Metadata { get; private set; } public static InstanceKey InvalidKey { get { return InstanceKey.invalidKey; } } public override bool Equals(object obj) { return this.Value.Equals(((InstanceKey)obj).Value); } public override int GetHashCode() { return this.Value.GetHashCode(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Runtime.DurableInstancing { using System.Collections.Generic; using System.Xml.Linq; [Fx.Tag.XamlVisible(false)] public class InstanceKey { static IDictionary emptyMetadata = new ReadOnlyDictionary (new Dictionary (0)); static InstanceKey invalidKey = new InstanceKey(); readonly bool invalid; // Comparisons to Guid.Empty are too slow. InstanceKey() { this.Value = Guid.Empty; this.invalid = true; } public InstanceKey(Guid value) : this(value, null) { } public InstanceKey(Guid value, IDictionary metadata) { if (value == Guid.Empty) { throw Fx.Exception.Argument("value", SRCore.InstanceKeyRequiresValidGuid); } this.Value = value; if (metadata != null) { this.Metadata = ReadOnlyDictionary .Create(metadata); } else { this.Metadata = emptyMetadata; } } public bool IsValid { get { return !this.invalid; } } public Guid Value { get; private set; } public IDictionary Metadata { get; private set; } public static InstanceKey InvalidKey { get { return InstanceKey.invalidKey; } } public override bool Equals(object obj) { return this.Value.Equals(((InstanceKey)obj).Value); } public override int GetHashCode() { return this.Value.GetHashCode(); } } } // 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
- LinkConverter.cs
- RoleManagerEventArgs.cs
- OverlappedAsyncResult.cs
- SelectionPattern.cs
- DbDataReader.cs
- PaintValueEventArgs.cs
- Int64Animation.cs
- TextComposition.cs
- PopOutPanel.cs
- PaperSource.cs
- HandleCollector.cs
- ForceCopyBuildProvider.cs
- CurrentChangedEventManager.cs
- COM2IDispatchConverter.cs
- TabItemAutomationPeer.cs
- CannotUnloadAppDomainException.cs
- RelatedCurrencyManager.cs
- PageCodeDomTreeGenerator.cs
- EpmAttributeNameBuilder.cs
- WmlPhoneCallAdapter.cs
- _ConnectStream.cs
- GraphicsContainer.cs
- VerificationAttribute.cs
- Transform3DGroup.cs
- WindowsFormsLinkLabel.cs
- TextView.cs
- XPathAxisIterator.cs
- BindingBase.cs
- DesignerActionVerbItem.cs
- BinaryNode.cs
- RelAssertionDirectKeyIdentifierClause.cs
- MonthChangedEventArgs.cs
- CharacterBuffer.cs
- ServiceDesigner.cs
- CodeDirectionExpression.cs
- FromRequest.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- RowVisual.cs
- Rotation3D.cs
- ConstructorExpr.cs
- NotificationContext.cs
- XsdBuildProvider.cs
- IntPtr.cs
- FormDesigner.cs
- ServiceNameCollection.cs
- NativeObjectSecurity.cs
- WindowProviderWrapper.cs
- SoapAttributes.cs
- QilTargetType.cs
- AppDomainUnloadedException.cs
- BamlTreeNode.cs
- TrailingSpaceComparer.cs
- ListSortDescription.cs
- MediaPlayer.cs
- NameTable.cs
- EnumBuilder.cs
- DataGridViewColumnCollection.cs
- InputReport.cs
- WebPartUtil.cs
- _HelperAsyncResults.cs
- ListDictionaryInternal.cs
- WebPartCollection.cs
- XXXOnTypeBuilderInstantiation.cs
- MobileFormsAuthentication.cs
- AVElementHelper.cs
- ResourceProperty.cs
- DataDesignUtil.cs
- AnnotationAdorner.cs
- HttpWebRequestElement.cs
- ObjectAssociationEndMapping.cs
- BitStream.cs
- XMLUtil.cs
- TreeWalkHelper.cs
- KeyGestureConverter.cs
- pingexception.cs
- PageRouteHandler.cs
- ConnectionPool.cs
- Sql8ExpressionRewriter.cs
- BamlTreeUpdater.cs
- GraphicsContext.cs
- ArrangedElementCollection.cs
- ReadOnlyDataSource.cs
- SafeSecurityHandles.cs
- FixedPageAutomationPeer.cs
- _ShellExpression.cs
- AppDomainUnloadedException.cs
- DoubleUtil.cs
- NativeMethods.cs
- AnnotationObservableCollection.cs
- SelectingProviderEventArgs.cs
- SqlNotificationEventArgs.cs
- XmlFormatExtensionAttribute.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- DetailsViewRow.cs
- DBCSCodePageEncoding.cs
- ConfigXmlText.cs
- SrgsItemList.cs
- MergablePropertyAttribute.cs
- ItemsPresenter.cs
- DataSetFieldSchema.cs