Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / System / Windows / LocalValueEnumerator.cs / 1 / LocalValueEnumerator.cs
using System;
using System.Collections;
using System.Diagnostics;
#pragma warning disable 1634, 1691 // suppressing PreSharp warnings
namespace System.Windows
{
///
/// Local value enumeration object
///
///
/// Modifying local values (via SetValue or ClearValue) during enumeration
/// is unsupported
///
public struct LocalValueEnumerator : IEnumerator
{
///
/// Overrides Object.GetHashCode
///
/// An integer that represents the hashcode for this object
public override int GetHashCode()
{
return base.GetHashCode();
}
///
/// Determine equality
///
public override bool Equals(object obj)
{
LocalValueEnumerator other = (LocalValueEnumerator) obj;
return (_count == other._count &&
_index == other._index &&
_snapshot == other._snapshot);
}
///
/// Determine equality
///
public static bool operator ==(LocalValueEnumerator obj1, LocalValueEnumerator obj2)
{
return obj1.Equals(obj2);
}
///
/// Determine inequality
///
public static bool operator !=(LocalValueEnumerator obj1, LocalValueEnumerator obj2)
{
return !(obj1 == obj2);
}
///
/// Get current entry
///
public LocalValueEntry Current
{
get
{
if(_index == -1 )
{
#pragma warning suppress 6503 // IEnumerator.Current is documented to throw this exception
throw new InvalidOperationException(SR.Get(SRID.LocalValueEnumerationReset));
}
if(_index >= Count )
{
#pragma warning suppress 6503 // IEnumerator.Current is documented to throw this exception
throw new InvalidOperationException(SR.Get(SRID.LocalValueEnumerationOutOfBounds));
}
return _snapshot[_index];
}
}
///
/// Get current entry (object reference based)
///
object IEnumerator.Current
{
get { return Current; }
}
///
/// Move to the next item in the enumerator
///
/// Success of the method
public bool MoveNext()
{
_index++;
return _index < Count;
}
///
/// Reset enumeration
///
public void Reset()
{
_index = -1;
}
///
/// Return number of items represented in the collection
///
public int Count
{
get { return _count; }
}
internal LocalValueEnumerator(LocalValueEntry[] snapshot, int count)
{
_index = -1;
_count = count;
_snapshot = snapshot;
}
private int _index;
private LocalValueEntry[] _snapshot;
private int _count;
}
///
/// Represents a Property-Value pair for local value enumeration
///
public struct LocalValueEntry
{
///
/// Overrides Object.GetHashCode
///
/// An integer that represents the hashcode for this object
public override int GetHashCode()
{
return base.GetHashCode();
}
///
/// Determine equality
///
public override bool Equals(object obj)
{
LocalValueEntry other = (LocalValueEntry) obj;
return (_dp == other._dp &&
_value == other._value);
}
///
/// Determine equality
///
public static bool operator ==(LocalValueEntry obj1, LocalValueEntry obj2)
{
return obj1.Equals(obj2);
}
///
/// Determine inequality
///
public static bool operator !=(LocalValueEntry obj1, LocalValueEntry obj2)
{
return !(obj1 == obj2);
}
///
/// Dependency property
///
public DependencyProperty Property
{
get { return _dp; }
}
///
/// Value of the property
///
public object Value
{
get { return _value; }
}
internal LocalValueEntry(DependencyProperty dp, object value)
{
_dp = dp;
_value = value;
}
// Internal here because we need to change these around when building
// the snapshot for the LocalValueEnumerator, and we can't make internal
// setters when we have public getters.
internal DependencyProperty _dp;
internal object _value;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Collections;
using System.Diagnostics;
#pragma warning disable 1634, 1691 // suppressing PreSharp warnings
namespace System.Windows
{
///
/// Local value enumeration object
///
///
/// Modifying local values (via SetValue or ClearValue) during enumeration
/// is unsupported
///
public struct LocalValueEnumerator : IEnumerator
{
///
/// Overrides Object.GetHashCode
///
/// An integer that represents the hashcode for this object
public override int GetHashCode()
{
return base.GetHashCode();
}
///
/// Determine equality
///
public override bool Equals(object obj)
{
LocalValueEnumerator other = (LocalValueEnumerator) obj;
return (_count == other._count &&
_index == other._index &&
_snapshot == other._snapshot);
}
///
/// Determine equality
///
public static bool operator ==(LocalValueEnumerator obj1, LocalValueEnumerator obj2)
{
return obj1.Equals(obj2);
}
///
/// Determine inequality
///
public static bool operator !=(LocalValueEnumerator obj1, LocalValueEnumerator obj2)
{
return !(obj1 == obj2);
}
///
/// Get current entry
///
public LocalValueEntry Current
{
get
{
if(_index == -1 )
{
#pragma warning suppress 6503 // IEnumerator.Current is documented to throw this exception
throw new InvalidOperationException(SR.Get(SRID.LocalValueEnumerationReset));
}
if(_index >= Count )
{
#pragma warning suppress 6503 // IEnumerator.Current is documented to throw this exception
throw new InvalidOperationException(SR.Get(SRID.LocalValueEnumerationOutOfBounds));
}
return _snapshot[_index];
}
}
///
/// Get current entry (object reference based)
///
object IEnumerator.Current
{
get { return Current; }
}
///
/// Move to the next item in the enumerator
///
/// Success of the method
public bool MoveNext()
{
_index++;
return _index < Count;
}
///
/// Reset enumeration
///
public void Reset()
{
_index = -1;
}
///
/// Return number of items represented in the collection
///
public int Count
{
get { return _count; }
}
internal LocalValueEnumerator(LocalValueEntry[] snapshot, int count)
{
_index = -1;
_count = count;
_snapshot = snapshot;
}
private int _index;
private LocalValueEntry[] _snapshot;
private int _count;
}
///
/// Represents a Property-Value pair for local value enumeration
///
public struct LocalValueEntry
{
///
/// Overrides Object.GetHashCode
///
/// An integer that represents the hashcode for this object
public override int GetHashCode()
{
return base.GetHashCode();
}
///
/// Determine equality
///
public override bool Equals(object obj)
{
LocalValueEntry other = (LocalValueEntry) obj;
return (_dp == other._dp &&
_value == other._value);
}
///
/// Determine equality
///
public static bool operator ==(LocalValueEntry obj1, LocalValueEntry obj2)
{
return obj1.Equals(obj2);
}
///
/// Determine inequality
///
public static bool operator !=(LocalValueEntry obj1, LocalValueEntry obj2)
{
return !(obj1 == obj2);
}
///
/// Dependency property
///
public DependencyProperty Property
{
get { return _dp; }
}
///
/// Value of the property
///
public object Value
{
get { return _value; }
}
internal LocalValueEntry(DependencyProperty dp, object value)
{
_dp = dp;
_value = value;
}
// Internal here because we need to change these around when building
// the snapshot for the LocalValueEnumerator, and we can't make internal
// setters when we have public getters.
internal DependencyProperty _dp;
internal object _value;
}
}
// 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
- FixedSOMPageConstructor.cs
- CodeNamespace.cs
- XmlReturnWriter.cs
- InstanceDataCollection.cs
- PartialCachingControl.cs
- ClonableStack.cs
- WebPartDescription.cs
- ProfileInfo.cs
- InputMethodStateChangeEventArgs.cs
- CodeSnippetExpression.cs
- IPipelineRuntime.cs
- ElementNotEnabledException.cs
- TextTreeRootTextBlock.cs
- HttpChannelHelpers.cs
- IPHostEntry.cs
- ToolStripItemCollection.cs
- EntityClassGenerator.cs
- UnmanagedHandle.cs
- IISMapPath.cs
- FrameworkTextComposition.cs
- QueryActivatableWorkflowsCommand.cs
- TreeNodeCollection.cs
- DispatcherSynchronizationContext.cs
- FactoryGenerator.cs
- HttpFormatExtensions.cs
- FileDocument.cs
- TransactionValidationBehavior.cs
- GridLengthConverter.cs
- CharUnicodeInfo.cs
- FormViewPageEventArgs.cs
- ASCIIEncoding.cs
- DataMember.cs
- SectionInformation.cs
- FileSystemEventArgs.cs
- XmlReaderSettings.cs
- ColorAnimationBase.cs
- BindingMemberInfo.cs
- StdRegProviderWrapper.cs
- XmlCountingReader.cs
- BaseCodeDomTreeGenerator.cs
- WebPartVerbCollection.cs
- XamlPointCollectionSerializer.cs
- RegionInfo.cs
- InstanceNormalEvent.cs
- CorePropertiesFilter.cs
- DataGridCellEditEndingEventArgs.cs
- IPPacketInformation.cs
- OutputCacheSettings.cs
- TypeUtils.cs
- IndicCharClassifier.cs
- DateTimeStorage.cs
- RequestCachingSection.cs
- RecipientInfo.cs
- ThaiBuddhistCalendar.cs
- SoapIncludeAttribute.cs
- IApplicationTrustManager.cs
- FilteredXmlReader.cs
- XmlDictionaryWriter.cs
- ParserContext.cs
- FixedSOMElement.cs
- SQLDecimalStorage.cs
- SizeAnimationUsingKeyFrames.cs
- AudioSignalProblemOccurredEventArgs.cs
- BuilderPropertyEntry.cs
- ToolStripItem.cs
- DataMemberFieldEditor.cs
- KeyEventArgs.cs
- FlowLayoutPanel.cs
- SQLByte.cs
- ClientTargetCollection.cs
- SemanticResultKey.cs
- Buffer.cs
- BookmarkScopeHandle.cs
- Padding.cs
- ListViewHitTestInfo.cs
- UIElement3DAutomationPeer.cs
- WebControlsSection.cs
- ExtensionQuery.cs
- DateTimeUtil.cs
- WeakReferenceList.cs
- Matrix3D.cs
- SingleStorage.cs
- DataMemberConverter.cs
- DbConnectionPoolIdentity.cs
- Control.cs
- SessionStateItemCollection.cs
- EntityFrameworkVersions.cs
- ObjectDataProvider.cs
- Attributes.cs
- QuaternionRotation3D.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- MailHeaderInfo.cs
- CompositeCollection.cs
- ControlTemplate.cs
- ArithmeticLiteral.cs
- SystemGatewayIPAddressInformation.cs
- WorkflowDebuggerSteppingAttribute.cs
- RC2CryptoServiceProvider.cs
- IndexedGlyphRun.cs
- Monitor.cs