Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Expressions / BinaryExpressionHelper.cs / 1305376 / BinaryExpressionHelper.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Expressions
{
using System.Activities.Validation;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq.Expressions;
using System.Runtime;
static class BinaryExpressionHelper
{
public static void OnGetArguments(CodeActivityMetadata metadata, InArgument left, InArgument right)
{
RuntimeArgument rightArgument = new RuntimeArgument("Right", typeof(TRight), ArgumentDirection.In, true);
metadata.Bind(right, rightArgument);
RuntimeArgument leftArgument = new RuntimeArgument("Left", typeof(TLeft), ArgumentDirection.In, true);
metadata.Bind(left, leftArgument);
metadata.SetArgumentsCollection(
new Collection
{
rightArgument,
leftArgument
});
}
public static bool TryGenerateLinqDelegate(ExpressionType operatorType, out Func function, out ValidationError validationError)
{
function = null;
validationError = null;
ParameterExpression leftParameter = Expression.Parameter(typeof(TLeft), "left");
ParameterExpression rightParameter = Expression.Parameter(typeof(TRight), "right");
try
{
BinaryExpression binaryExpression = Expression.MakeBinary(operatorType, leftParameter, rightParameter);
Expression> lambdaExpression = Expression.Lambda>(binaryExpression, leftParameter, rightParameter);
function = lambdaExpression.Compile();
return true;
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
validationError = new ValidationError(e.Message);
return false;
}
}
}
}
// 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
- ModelItemCollection.cs
- BinaryObjectReader.cs
- WebConfigurationHostFileChange.cs
- WaitHandle.cs
- StatusBarItemAutomationPeer.cs
- CodeDirectoryCompiler.cs
- UnsafeCollabNativeMethods.cs
- DataGridViewDataErrorEventArgs.cs
- X509Utils.cs
- PropertyEmitter.cs
- HtmlTableCellCollection.cs
- WorkflowOperationFault.cs
- QilXmlWriter.cs
- RegexCaptureCollection.cs
- SqlConnectionPoolGroupProviderInfo.cs
- RemoteWebConfigurationHostServer.cs
- CqlParser.cs
- CorrelationManager.cs
- Composition.cs
- ReadOnlyHierarchicalDataSource.cs
- XmlSignatureManifest.cs
- TextCharacters.cs
- InfoCardClaimCollection.cs
- XmlSchemaAttributeGroupRef.cs
- InputElement.cs
- SiteMapNode.cs
- BufferModesCollection.cs
- EntityDataSourceChangingEventArgs.cs
- DesignerView.cs
- XmlNodeChangedEventArgs.cs
- _ListenerResponseStream.cs
- EpmContentDeSerializerBase.cs
- WebBaseEventKeyComparer.cs
- AsymmetricAlgorithm.cs
- SessionPageStateSection.cs
- AnimationClock.cs
- PersonalizationState.cs
- DataGridViewLinkColumn.cs
- FactoryMaker.cs
- XmlUrlResolver.cs
- DefaultBindingPropertyAttribute.cs
- CodeLabeledStatement.cs
- TypedDatasetGenerator.cs
- DataRowChangeEvent.cs
- ObjectStateEntry.cs
- CultureSpecificCharacterBufferRange.cs
- WpfXamlLoader.cs
- ExpandableObjectConverter.cs
- DataSetUtil.cs
- SqlParameterizer.cs
- XmlNotation.cs
- BoundColumn.cs
- DbConnectionPool.cs
- SiteMapNode.cs
- IndicCharClassifier.cs
- HtmlHistory.cs
- CaseInsensitiveHashCodeProvider.cs
- IPEndPoint.cs
- TempFiles.cs
- ExplicitDiscriminatorMap.cs
- UnsafeNativeMethods.cs
- UriTemplateTableMatchCandidate.cs
- ReadOnlyAttribute.cs
- RequestQueue.cs
- ScrollContentPresenter.cs
- TableColumn.cs
- _NegoState.cs
- ILGenerator.cs
- TdsParserHelperClasses.cs
- DataGridViewComponentPropertyGridSite.cs
- HttpResponse.cs
- PageStatePersister.cs
- RenderTargetBitmap.cs
- BufferBuilder.cs
- EntityContainer.cs
- TextTreeTextNode.cs
- TextBoxBase.cs
- EventLogPermissionEntry.cs
- Random.cs
- ControlBuilderAttribute.cs
- CodeFieldReferenceExpression.cs
- DropSource.cs
- ExtendedTransformFactory.cs
- ZipArchive.cs
- StateMachineWorkflowInstance.cs
- SignatureHelper.cs
- WebCategoryAttribute.cs
- TypedDataSetSchemaImporterExtensionFx35.cs
- webeventbuffer.cs
- BasicCellRelation.cs
- ContentDesigner.cs
- Parallel.cs
- KnownTypesProvider.cs
- BamlRecordReader.cs
- XPathArrayIterator.cs
- CodeChecksumPragma.cs
- AuthorizationRuleCollection.cs
- FrameAutomationPeer.cs
- MaskedTextBoxTextEditor.cs
- FlowDocumentScrollViewer.cs