Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Base / Interaction / Model / ModelMemberCollection.cs / 1305376 / ModelMemberCollection.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Activities.Presentation.Model {
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Activities.Presentation;
///
/// ModelMemberCollection is an abstract base class that
/// ModelPropertyCollection and ModelEventCollection derive from.
///
/// The type of item the collection represents.
/// The type that should be used as a key in "Find" methods.
public abstract class ModelMemberCollection : IEnumerable, IEnumerable {
///
/// Internal constructor. Only our own collections can derive from this class.
///
internal ModelMemberCollection() { }
///
/// Searches the collection for the given key and returns it
/// if it is found. If not found, this throws an exception.
///
///
///
/// if name is null.
/// if name is not found.
public TItemType this[string name] {
get {
if (name == null) throw FxTrace.Exception.ArgumentNull("name");
return Find(name, true);
}
}
///
/// Searches the collection for the given key and returns it
/// if it is found. If not found, this throws an exception.
///
///
///
/// if value is null.
/// if value is not found.
[SuppressMessage("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers")]
public TItemType this[TFindType value] {
get {
if (value == null) throw FxTrace.Exception.ArgumentNull("value");
return Find(value, true);
}
}
///
/// Searches the collection for the given key and returns it if it is
/// found. If not found, this returns null.
///
///
///
/// if name is null.
public TItemType Find(string name) {
if (name == null) throw FxTrace.Exception.ArgumentNull("name");
return Find(name, false);
}
///
/// Searches the collection for the given key and returns it if it is
/// found. If not found, this throws an exception or returns null,
/// depending on the value passed to throwOnError.
///
///
///
///
/// if name is not found and throwOnError is true.
protected abstract TItemType Find(string name, bool throwOnError);
///
/// Searches the collection for the given key and returns it if it is
/// found. If not found, this returns null.
///
///
///
/// if value is null.
public TItemType Find(TFindType value) {
if (value == null) throw FxTrace.Exception.ArgumentNull("value");
return Find(value, false);
}
///
/// Searches the collection for the given key and returns it if it is
/// found. If not found, this throws an exception or returns null,
/// depending on the value passed to throwOnError.
///
///
///
///
/// if value is not found and throwOnError is true.
protected abstract TItemType Find(TFindType value, bool throwOnError);
///
/// Returns an enumerator to enumerate values.
///
///
public abstract IEnumerator GetEnumerator();
#region IEnumerable Members
///
/// IEnumerable Implementation.
///
///
IEnumerator IEnumerable.GetEnumerator() {
return GetEnumerator();
}
#endregion
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Activities.Presentation.Model {
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Activities.Presentation;
///
/// ModelMemberCollection is an abstract base class that
/// ModelPropertyCollection and ModelEventCollection derive from.
///
/// The type of item the collection represents.
/// The type that should be used as a key in "Find" methods.
public abstract class ModelMemberCollection : IEnumerable, IEnumerable {
///
/// Internal constructor. Only our own collections can derive from this class.
///
internal ModelMemberCollection() { }
///
/// Searches the collection for the given key and returns it
/// if it is found. If not found, this throws an exception.
///
///
///
/// if name is null.
/// if name is not found.
public TItemType this[string name] {
get {
if (name == null) throw FxTrace.Exception.ArgumentNull("name");
return Find(name, true);
}
}
///
/// Searches the collection for the given key and returns it
/// if it is found. If not found, this throws an exception.
///
///
///
/// if value is null.
/// if value is not found.
[SuppressMessage("Microsoft.Design", "CA1043:UseIntegralOrStringArgumentForIndexers")]
public TItemType this[TFindType value] {
get {
if (value == null) throw FxTrace.Exception.ArgumentNull("value");
return Find(value, true);
}
}
///
/// Searches the collection for the given key and returns it if it is
/// found. If not found, this returns null.
///
///
///
/// if name is null.
public TItemType Find(string name) {
if (name == null) throw FxTrace.Exception.ArgumentNull("name");
return Find(name, false);
}
///
/// Searches the collection for the given key and returns it if it is
/// found. If not found, this throws an exception or returns null,
/// depending on the value passed to throwOnError.
///
///
///
///
/// if name is not found and throwOnError is true.
protected abstract TItemType Find(string name, bool throwOnError);
///
/// Searches the collection for the given key and returns it if it is
/// found. If not found, this returns null.
///
///
///
/// if value is null.
public TItemType Find(TFindType value) {
if (value == null) throw FxTrace.Exception.ArgumentNull("value");
return Find(value, false);
}
///
/// Searches the collection for the given key and returns it if it is
/// found. If not found, this throws an exception or returns null,
/// depending on the value passed to throwOnError.
///
///
///
///
/// if value is not found and throwOnError is true.
protected abstract TItemType Find(TFindType value, bool throwOnError);
///
/// Returns an enumerator to enumerate values.
///
///
public abstract IEnumerator GetEnumerator();
#region IEnumerable Members
///
/// IEnumerable Implementation.
///
///
IEnumerator IEnumerable.GetEnumerator() {
return GetEnumerator();
}
#endregion
}
}
// 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
- SubstitutionList.cs
- PointCollection.cs
- TextRange.cs
- SequentialOutput.cs
- BrowserDefinitionCollection.cs
- GenericIdentity.cs
- HttpHandler.cs
- RegexGroup.cs
- FileUpload.cs
- SafeThemeHandle.cs
- ProgressBarHighlightConverter.cs
- ListParagraph.cs
- InstanceDataCollection.cs
- StrongName.cs
- XmlWrappingWriter.cs
- TreeNodeMouseHoverEvent.cs
- BindingExpressionUncommonField.cs
- EventLogPermissionEntryCollection.cs
- CheckedListBox.cs
- X509Certificate2.cs
- CodeExpressionCollection.cs
- ProxyAttribute.cs
- HttpAsyncResult.cs
- ComplexPropertyEntry.cs
- PathSegmentCollection.cs
- BufferModeSettings.cs
- DiscoveryMessageSequence11.cs
- PointKeyFrameCollection.cs
- HitTestResult.cs
- TextTreeTextBlock.cs
- SqlFormatter.cs
- CacheModeConverter.cs
- _DigestClient.cs
- InheritablePropertyChangeInfo.cs
- MapPathBasedVirtualPathProvider.cs
- SchemaManager.cs
- AuthorizationRule.cs
- EditorPart.cs
- IpcChannelHelper.cs
- HashAlgorithm.cs
- RightsManagementEncryptedStream.cs
- ZipIORawDataFileBlock.cs
- DownloadProgressEventArgs.cs
- InkCanvasAutomationPeer.cs
- WindowsTokenRoleProvider.cs
- unitconverter.cs
- SettingsPropertyIsReadOnlyException.cs
- ConfigXmlText.cs
- InputLanguage.cs
- XmlAttributeHolder.cs
- RegistryExceptionHelper.cs
- ThicknessKeyFrameCollection.cs
- FrameAutomationPeer.cs
- LinearGradientBrush.cs
- ListBoxItemWrapperAutomationPeer.cs
- ObjectToken.cs
- RuleAction.cs
- EnumUnknown.cs
- WindowsNonControl.cs
- DataProviderNameConverter.cs
- SchemaTypeEmitter.cs
- Rotation3DKeyFrameCollection.cs
- EmissiveMaterial.cs
- formatter.cs
- AvTraceDetails.cs
- SourceFileBuildProvider.cs
- BuildManagerHost.cs
- AtomContentProperty.cs
- DataGridTablesFactory.cs
- Invariant.cs
- ToolboxDataAttribute.cs
- ListViewPagedDataSource.cs
- Model3D.cs
- PagedDataSource.cs
- VisualState.cs
- MaterialGroup.cs
- ChangeTracker.cs
- ThreadInterruptedException.cs
- Automation.cs
- xml.cs
- TrackingLocationCollection.cs
- FacetDescription.cs
- VirtualizingPanel.cs
- Root.cs
- HttpDebugHandler.cs
- CharacterHit.cs
- SafePEFileHandle.cs
- FormatSettings.cs
- FolderBrowserDialog.cs
- DataGridItem.cs
- ZeroOpNode.cs
- QueryExpr.cs
- LoadedEvent.cs
- KeyConverter.cs
- EndpointIdentityExtension.cs
- HttpFileCollection.cs
- ListBindingConverter.cs
- DeferredBinaryDeserializerExtension.cs
- DataGridViewControlCollection.cs
- Light.cs