Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Expressions / Or.cs / 1305376 / Or.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Expressions
{
using System.Activities;
using System.Activities.Validation;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;
using System.Runtime;
[SuppressMessage(FxCop.Category.Naming, FxCop.Rule.IdentifiersShouldNotMatchKeywords,
Justification = "Optimizing for XAML naming. VB imperative users will [] qualify (e.g. New [Or])")]
public sealed class Or : CodeActivity
{
//Lock is not needed for operationFunction here. The reason is that delegates for a given Or are the same.
//It's possible that 2 threads are assigning the operationFucntion at the same time. But it's okay because the compiled codes are the same.
static Func operationFunction;
[RequiredArgument]
[DefaultValue(null)]
public InArgument Left
{
get;
set;
}
[RequiredArgument]
[DefaultValue(null)]
public InArgument Right
{
get;
set;
}
protected override void CacheMetadata(CodeActivityMetadata metadata)
{
BinaryExpressionHelper.OnGetArguments(metadata, this.Left, this.Right);
if (operationFunction == null)
{
ValidationError validationError;
if (!BinaryExpressionHelper.TryGenerateLinqDelegate(ExpressionType.Or, out operationFunction, out validationError))
{
metadata.AddValidationError(validationError);
}
}
}
protected override TResult Execute(CodeActivityContext context)
{
Fx.Assert(operationFunction != null, "OperationFunction must exist.");
TLeft leftValue = this.Left.Get(context);
TRight rightValue = this.Right.Get(context);
return operationFunction(leftValue, rightValue);
}
}
}
// 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
- ProgressBarRenderer.cs
- Stroke.cs
- DocComment.cs
- SignatureHelper.cs
- TypedElement.cs
- CfgParser.cs
- WebServiceResponse.cs
- AncestorChangedEventArgs.cs
- NullableConverter.cs
- CollectionEditVerbManager.cs
- SelectQueryOperator.cs
- EntityDataSourceUtil.cs
- TextRangeProviderWrapper.cs
- DoubleStorage.cs
- EventRecord.cs
- Pair.cs
- CodeSubDirectory.cs
- Atom10FormatterFactory.cs
- FileSystemInfo.cs
- IPAddress.cs
- FaultBookmark.cs
- WebServiceEnumData.cs
- ColorAnimationUsingKeyFrames.cs
- SqlDesignerDataSourceView.cs
- ReadOnlyHierarchicalDataSource.cs
- EntityDataSourceContextCreatingEventArgs.cs
- CssClassPropertyAttribute.cs
- SequentialOutput.cs
- SevenBitStream.cs
- BrushProxy.cs
- PresentationAppDomainManager.cs
- DoubleConverter.cs
- SvcMapFile.cs
- CodeEventReferenceExpression.cs
- WebPartCloseVerb.cs
- ManipulationStartingEventArgs.cs
- AnnotationHighlightLayer.cs
- IDataContractSurrogate.cs
- EnumDataContract.cs
- MappedMetaModel.cs
- RuntimeArgumentHandle.cs
- SiteMapNodeItemEventArgs.cs
- TextAction.cs
- RoleManagerEventArgs.cs
- StoreContentChangedEventArgs.cs
- CheckPair.cs
- TemplateComponentConnector.cs
- DriveInfo.cs
- ExplicitDiscriminatorMap.cs
- DirectoryObjectSecurity.cs
- TypeConverterValueSerializer.cs
- ISAPIRuntime.cs
- WebResourceAttribute.cs
- XmlNode.cs
- NullExtension.cs
- Calendar.cs
- SignedPkcs7.cs
- EmptyEnumerator.cs
- SafePointer.cs
- BinaryConverter.cs
- TextEditorSpelling.cs
- HtmlUtf8RawTextWriter.cs
- MetadataCollection.cs
- XXXOnTypeBuilderInstantiation.cs
- SpinWait.cs
- TableRow.cs
- DocumentStatusResources.cs
- InvalidAsynchronousStateException.cs
- SymLanguageType.cs
- XmlUtf8RawTextWriter.cs
- MarkupProperty.cs
- CodeStatementCollection.cs
- Parameter.cs
- RuleConditionDialog.Designer.cs
- HtmlSelect.cs
- ScriptRegistrationManager.cs
- WaitHandleCannotBeOpenedException.cs
- Serializer.cs
- PrimarySelectionGlyph.cs
- AspNetCompatibilityRequirementsMode.cs
- NativeActivityContext.cs
- CapabilitiesAssignment.cs
- TypeGeneratedEventArgs.cs
- Win32.cs
- dsa.cs
- CallContext.cs
- StringConverter.cs
- InputScopeConverter.cs
- Cast.cs
- Canonicalizers.cs
- ComponentCommands.cs
- FileUtil.cs
- Bezier.cs
- XsltException.cs
- ImpersonationContext.cs
- StreamAsIStream.cs
- XmlSchemaSimpleContent.cs
- DateTime.cs
- HtmlButton.cs
- CodeGroup.cs