Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Expressions / ArgumentValue.cs / 1305376 / ArgumentValue.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.Activities.Expressions { using System.Collections.Generic; using System.Linq.Expressions; using System.Runtime; using System.Windows.Markup; public sealed class ArgumentValue: CodeActivity { RuntimeArgument targetArgument; public ArgumentValue() { } public ArgumentValue(string argumentName) { this.ArgumentName = argumentName; } public string ArgumentName { get; set; } protected override void CacheMetadata(CodeActivityMetadata metadata) { this.targetArgument = null; if (string.IsNullOrEmpty(this.ArgumentName)) { metadata.AddValidationError(SR.ArgumentNameRequired); } else { this.targetArgument = ActivityUtilities.FindArgument(this.ArgumentName, this); if (this.targetArgument == null) { metadata.AddValidationError(SR.ArgumentNotFound(this.ArgumentName)); } else if (!TypeHelper.AreTypesCompatible(this.targetArgument.Type, typeof(T))) { metadata.AddValidationError(SR.ArgumentTypeMustBeCompatible(this.ArgumentName, this.targetArgument.Type, typeof(T))); } } } public override string ToString() { if (!string.IsNullOrEmpty(this.ArgumentName)) { return this.ArgumentName; } return base.ToString(); } internal override bool TryGetValue(ActivityContext context, out T value) { if (this.targetArgument == null) { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.UnopenedActivitiesCannotBeExecuted(this.DisplayName))); } try { context.AllowChainedEnvironmentAccess = true; value = context.GetValue (this.targetArgument); } finally { context.AllowChainedEnvironmentAccess = false; } return true; } protected override T Execute(CodeActivityContext context) { return ExecuteWithTryGetValue(context); } } } // 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
- DbProviderFactory.cs
- AlternateViewCollection.cs
- WsdlBuildProvider.cs
- XmlElementAttribute.cs
- TypefaceCollection.cs
- AspProxy.cs
- ComUdtElement.cs
- TextElementCollectionHelper.cs
- XmlSchemaAnnotated.cs
- PointConverter.cs
- CodeSnippetExpression.cs
- DbProviderFactories.cs
- TypeExtensionSerializer.cs
- RemotingServices.cs
- MessageQueueCriteria.cs
- ConsumerConnectionPoint.cs
- SpecularMaterial.cs
- AppSettingsSection.cs
- RegistryKey.cs
- DataKey.cs
- EventProviderBase.cs
- MatrixAnimationBase.cs
- SqlProviderServices.cs
- IRCollection.cs
- WindowsImpersonationContext.cs
- HtmlShim.cs
- FlowPosition.cs
- ContractListAdapter.cs
- HtmlControlPersistable.cs
- TypeLibConverter.cs
- Tablet.cs
- SQLSingle.cs
- CodeGroup.cs
- ExpressionBindingCollection.cs
- XmlTextWriter.cs
- IndexOutOfRangeException.cs
- DecimalAnimationUsingKeyFrames.cs
- DataGridViewMethods.cs
- Ops.cs
- BindingSource.cs
- Panel.cs
- Policy.cs
- CachedRequestParams.cs
- DecoderNLS.cs
- Transform3DCollection.cs
- FamilyTypefaceCollection.cs
- IIS7UserPrincipal.cs
- UpWmlPageAdapter.cs
- ElementAction.cs
- MimeWriter.cs
- ForwardPositionQuery.cs
- SelectionRange.cs
- DataSvcMapFileSerializer.cs
- XmlReflectionImporter.cs
- DBSqlParserTableCollection.cs
- ToolStripSeparatorRenderEventArgs.cs
- SplitterEvent.cs
- XamlFigureLengthSerializer.cs
- _ListenerAsyncResult.cs
- PackageRelationshipCollection.cs
- XmlEncoding.cs
- CodeConditionStatement.cs
- SafeMarshalContext.cs
- followingsibling.cs
- NoneExcludedImageIndexConverter.cs
- ApplicationManager.cs
- NetPipeSection.cs
- TrackingDataItemValue.cs
- LoginStatusDesigner.cs
- TranslateTransform3D.cs
- LogicalTreeHelper.cs
- EncoderParameter.cs
- ThreadStartException.cs
- InternalException.cs
- Matrix3D.cs
- ActivityExecutionContext.cs
- BaseCollection.cs
- GAC.cs
- XmlConverter.cs
- RTLAwareMessageBox.cs
- ConfigUtil.cs
- OleDbMetaDataFactory.cs
- SQLInt16Storage.cs
- VScrollProperties.cs
- RbTree.cs
- DocumentNUp.cs
- FunctionQuery.cs
- Point4D.cs
- baseaxisquery.cs
- Rotation3DAnimationBase.cs
- CircleHotSpot.cs
- DataMember.cs
- DocumentPageTextView.cs
- GeneralTransform3DGroup.cs
- WebPartsSection.cs
- AssemblyHash.cs
- _HeaderInfoTable.cs
- Style.cs
- PresentationTraceSources.cs
- SpellerInterop.cs