Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Statements / RemoveFromCollection.cs / 1305376 / RemoveFromCollection.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Statements { using System; using System.Collections.Generic; using System.ComponentModel; using System.Windows.Markup; using System.Diagnostics.CodeAnalysis; using System.Runtime; using System.Collections.ObjectModel; [SuppressMessage(FxCop.Category.Naming, FxCop.Rule.IdentifiersShouldNotHaveIncorrectSuffix, Justification = "Optimizing for XAML naming.")] [ContentProperty("Collection")] public sealed class RemoveFromCollection: CodeActivity { [RequiredArgument] [DefaultValue(null)] public InArgument > Collection { get; set; } [RequiredArgument] [DefaultValue(null)] public InArgument Item { get; set; } protected override void CacheMetadata(CodeActivityMetadata metadata) { RuntimeArgument collectionArgument = new RuntimeArgument("Collection", typeof(ICollection ), ArgumentDirection.In, true); metadata.Bind(this.Collection, collectionArgument); RuntimeArgument itemArgument = new RuntimeArgument("Item", typeof(T), ArgumentDirection.In, true); metadata.Bind(this.Item, itemArgument); RuntimeArgument resultArgument = new RuntimeArgument("Result", typeof(bool), ArgumentDirection.Out); metadata.Bind(this.Result, resultArgument); metadata.SetArgumentsCollection( new Collection { collectionArgument, itemArgument, resultArgument }); } protected override bool Execute(CodeActivityContext context) { ICollection collection = this.Collection.Get(context); if (collection == null) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.CollectionActivityRequiresCollection(this.DisplayName))); } T item = this.Item.Get(context); return collection.Remove(item); } } } // 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
- ListControl.cs
- LessThanOrEqual.cs
- IPipelineRuntime.cs
- ServiceReference.cs
- SafeCertificateStore.cs
- _LocalDataStore.cs
- CommittableTransaction.cs
- StateMachineHelpers.cs
- DeviceSpecificChoice.cs
- NTAccount.cs
- FormsAuthenticationCredentials.cs
- querybuilder.cs
- ColorConvertedBitmap.cs
- FixedSOMPageConstructor.cs
- XamlStackWriter.cs
- Preprocessor.cs
- ApplicationHost.cs
- VerificationAttribute.cs
- TargetConverter.cs
- InheritanceContextHelper.cs
- CompensateDesigner.cs
- MethodBody.cs
- ProxyWebPartManager.cs
- GridViewCancelEditEventArgs.cs
- TableLayoutCellPaintEventArgs.cs
- HScrollBar.cs
- ViewgenContext.cs
- LinqDataSourceStatusEventArgs.cs
- HwndAppCommandInputProvider.cs
- AuthenticationModeHelper.cs
- XmlChoiceIdentifierAttribute.cs
- CorrelationScope.cs
- DataColumnMapping.cs
- PolicyManager.cs
- ImageDrawing.cs
- RoleManagerSection.cs
- OutputCacheProfileCollection.cs
- ValidatorCompatibilityHelper.cs
- ManifestResourceInfo.cs
- Int64AnimationUsingKeyFrames.cs
- NameValuePermission.cs
- AuthStoreRoleProvider.cs
- panel.cs
- TypeFieldSchema.cs
- ImmComposition.cs
- Rotation3DKeyFrameCollection.cs
- SizeAnimationClockResource.cs
- ZipFileInfo.cs
- OleDbTransaction.cs
- WebControl.cs
- AnnotationAuthorChangedEventArgs.cs
- TextUtf8RawTextWriter.cs
- EtwTrace.cs
- RtfNavigator.cs
- ActivationServices.cs
- ByeOperation11AsyncResult.cs
- BinaryNode.cs
- HtmlGenericControl.cs
- ping.cs
- PageSetupDialog.cs
- RegexGroupCollection.cs
- Scanner.cs
- ExpressionBuilderCollection.cs
- OnOperation.cs
- ResourceContainer.cs
- WorkflowDebuggerSteppingAttribute.cs
- JpegBitmapEncoder.cs
- WorkflowInlining.cs
- ColorTransform.cs
- OdbcConnectionOpen.cs
- UnsafeNativeMethods.cs
- HttpServerUtilityBase.cs
- ObjectHandle.cs
- WebServiceParameterData.cs
- SafeFileMappingHandle.cs
- CollectionChange.cs
- ReadonlyMessageFilter.cs
- ActivityInfo.cs
- WindowsSolidBrush.cs
- PropertyPath.cs
- Grid.cs
- BasePattern.cs
- EntryPointNotFoundException.cs
- SubqueryTrackingVisitor.cs
- IndependentAnimationStorage.cs
- HashCodeCombiner.cs
- EncoderBestFitFallback.cs
- SessionSwitchEventArgs.cs
- UTF8Encoding.cs
- DynamicQueryStringParameter.cs
- AdRotator.cs
- GridViewUpdateEventArgs.cs
- ActivatedMessageQueue.cs
- WindowVisualStateTracker.cs
- AssemblyAttributes.cs
- JpegBitmapEncoder.cs
- DisposableCollectionWrapper.cs
- PtsHost.cs
- DataView.cs
- XPathArrayIterator.cs