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
- PerformanceCounter.cs
- ServiceOperation.cs
- Int32RectConverter.cs
- FragmentQueryProcessor.cs
- NonceToken.cs
- XmlComment.cs
- DependencyPropertyValueSerializer.cs
- storepermissionattribute.cs
- LiteralControl.cs
- SoundPlayer.cs
- FacetDescriptionElement.cs
- XmlSchemaRedefine.cs
- PriorityItem.cs
- ExceptionRoutedEventArgs.cs
- LiteralControl.cs
- OleDbTransaction.cs
- UIElement.cs
- SplineQuaternionKeyFrame.cs
- XmlAttributeAttribute.cs
- XamlTreeBuilderBamlRecordWriter.cs
- DeclaredTypeValidatorAttribute.cs
- SerialPinChanges.cs
- SystemIcmpV4Statistics.cs
- GridViewEditEventArgs.cs
- RegularExpressionValidator.cs
- DataListItemEventArgs.cs
- ProcessProtocolHandler.cs
- ConfigXmlAttribute.cs
- SQLMoney.cs
- ToggleButton.cs
- ThreadStartException.cs
- IHttpResponseInternal.cs
- PackageDigitalSignature.cs
- EncryptedType.cs
- GeometryHitTestParameters.cs
- XmlDictionaryWriter.cs
- StorageEntityContainerMapping.cs
- FieldNameLookup.cs
- CellTreeNodeVisitors.cs
- KnowledgeBase.cs
- MULTI_QI.cs
- SmtpMail.cs
- Invariant.cs
- SqlDataSourceEnumerator.cs
- WebHttpSecurity.cs
- MemoryMappedView.cs
- MouseGestureConverter.cs
- RepeaterDataBoundAdapter.cs
- SpotLight.cs
- ComponentManagerBroker.cs
- PersonalizationProviderHelper.cs
- WinFormsSecurity.cs
- ArgumentDesigner.xaml.cs
- ResXFileRef.cs
- FileVersionInfo.cs
- XamlStyleSerializer.cs
- TextContainerChangeEventArgs.cs
- KeyGestureConverter.cs
- TokenCreationParameter.cs
- BindingOperations.cs
- RtType.cs
- OperationAbortedException.cs
- ChangeNode.cs
- PathSegment.cs
- RefExpr.cs
- coordinatorfactory.cs
- ModelPerspective.cs
- GenerateScriptTypeAttribute.cs
- CollectionBuilder.cs
- SchemaImporterExtensionElement.cs
- SiteMap.cs
- IndexedGlyphRun.cs
- ExpressionVisitor.cs
- SqlNotificationRequest.cs
- ActivityBindForm.cs
- ColumnMapProcessor.cs
- BaseDataBoundControl.cs
- IRCollection.cs
- HierarchicalDataBoundControlAdapter.cs
- HttpWebRequestElement.cs
- ValueChangedEventManager.cs
- PingOptions.cs
- DesignerView.xaml.cs
- PerformanceCounterPermission.cs
- DesignerResources.cs
- AssociationType.cs
- XPathAxisIterator.cs
- StsCommunicationException.cs
- AbstractSvcMapFileLoader.cs
- SequentialUshortCollection.cs
- Accessible.cs
- OptimizedTemplateContentHelper.cs
- ECDsa.cs
- DataStorage.cs
- WsatConfiguration.cs
- ConfigsHelper.cs
- XmlWrappingReader.cs
- MarkupProperty.cs
- AppearanceEditorPart.cs
- MultiBindingExpression.cs