Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Expressions / GreaterThan.cs / 1305376 / GreaterThan.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Expressions
{
using System.Activities;
using System.Activities.Validation;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Runtime;
public sealed class GreaterThan : CodeActivity
{
//Lock is not needed for operationFunction here. The reason is that delegates for a given GreaterThan 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.GreaterThan, 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
- ListenerConnectionModeReader.cs
- PeerTransportListenAddressConverter.cs
- DataSet.cs
- Header.cs
- EntityViewGenerationAttribute.cs
- DataGridItemCollection.cs
- SHA384Managed.cs
- DataControlFieldsEditor.cs
- FileSystemWatcher.cs
- KnownBoxes.cs
- PrintPageEvent.cs
- Row.cs
- SqlDeflator.cs
- HostingPreferredMapPath.cs
- RegexCode.cs
- EndpointDiscoveryMetadata.cs
- ValidationHelpers.cs
- TextServicesHost.cs
- Input.cs
- WmfPlaceableFileHeader.cs
- IPAddress.cs
- NTAccount.cs
- SupportingTokenBindingElement.cs
- PropertyTab.cs
- BaseDataList.cs
- DataGridCaption.cs
- DataGridTablesFactory.cs
- SecurityTokenAuthenticator.cs
- HttpBufferlessInputStream.cs
- Automation.cs
- ItemsChangedEventArgs.cs
- RequestStatusBarUpdateEventArgs.cs
- PagedControl.cs
- PropertyGridView.cs
- BufferedReadStream.cs
- Mapping.cs
- EventMap.cs
- MethodExpr.cs
- IgnoreFileBuildProvider.cs
- Frame.cs
- WebGetAttribute.cs
- ColumnCollection.cs
- Int64Animation.cs
- EventLogPermissionEntryCollection.cs
- TextParaLineResult.cs
- XamlTemplateSerializer.cs
- EntitySetDataBindingList.cs
- DecoderReplacementFallback.cs
- ModelTreeManager.cs
- DataServiceExpressionVisitor.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- AttachedPropertyMethodSelector.cs
- followingsibling.cs
- PerformanceCounterCategory.cs
- PageOutputQuality.cs
- FormViewInsertedEventArgs.cs
- BrowserCapabilitiesFactoryBase.cs
- COSERVERINFO.cs
- ValueUtilsSmi.cs
- TransformerInfo.cs
- TrustSection.cs
- AuthorizationBehavior.cs
- RepeaterItemCollection.cs
- OperationAbortedException.cs
- BamlReader.cs
- UndoUnit.cs
- XmlSerializationGeneratedCode.cs
- DocumentXPathNavigator.cs
- Clause.cs
- OptionalColumn.cs
- DynamicILGenerator.cs
- RequestCachingSection.cs
- CancellationTokenSource.cs
- IndentedTextWriter.cs
- EventHandlingScope.cs
- ComNativeDescriptor.cs
- LogFlushAsyncResult.cs
- PartialToken.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- UInt32.cs
- BoundingRectTracker.cs
- HasCopySemanticsAttribute.cs
- X509SubjectKeyIdentifierClause.cs
- ParameterInfo.cs
- TextBoxBase.cs
- HttpCapabilitiesEvaluator.cs
- DocumentSequence.cs
- ImpersonationContext.cs
- BitmapImage.cs
- Executor.cs
- PenContexts.cs
- DiagnosticTraceSource.cs
- XmlSchemaGroup.cs
- ColorAnimationBase.cs
- DeferredElementTreeState.cs
- QueryContinueDragEventArgs.cs
- Size3D.cs
- IApplicationTrustManager.cs
- WmlPhoneCallAdapter.cs
- ControlIdConverter.cs