Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Expressions / UnaryExpressionHelper.cs / 1305376 / UnaryExpressionHelper.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Expressions { using System.Activities.Validation; using System.Collections.ObjectModel; using System.Linq.Expressions; using System.Runtime; static class UnaryExpressionHelper { public static void OnGetArguments(CodeActivityMetadata metadata, InArgument operand) { RuntimeArgument operandArgument = new RuntimeArgument("Operand", typeof(TOperand), ArgumentDirection.In, true); metadata.Bind(operand, operandArgument); metadata.SetArgumentsCollection( new Collection { operandArgument }); } public static bool TryGenerateLinqDelegate (ExpressionType operatorType, out Func operation, out ValidationError validationError) { operation = null; validationError = null; ParameterExpression operandParameter = Expression.Parameter(typeof(TOperand), "operand"); try { UnaryExpression unaryExpression = Expression.MakeUnary(operatorType, operandParameter, typeof(TResult)); Expression > lambdaExpression = Expression.Lambda >(unaryExpression, operandParameter); operation = 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
- SafeLocalAllocation.cs
- TrustSection.cs
- WSSecureConversationDec2005.cs
- DataColumn.cs
- Keywords.cs
- CacheOutputQuery.cs
- UnmanagedMarshal.cs
- Page.cs
- WebPartDisplayMode.cs
- DataRow.cs
- HttpPostedFile.cs
- Helpers.cs
- WebSysDefaultValueAttribute.cs
- AdministrationHelpers.cs
- GcSettings.cs
- TypeRefElement.cs
- GeometryHitTestResult.cs
- TemplateBamlRecordReader.cs
- shaperfactoryquerycachekey.cs
- ContractListAdapter.cs
- ConstructorArgumentAttribute.cs
- ProfileEventArgs.cs
- BindingMemberInfo.cs
- TileBrush.cs
- DbParameterCollection.cs
- ColorConvertedBitmap.cs
- SchemaTypeEmitter.cs
- ToolStripGripRenderEventArgs.cs
- Debug.cs
- Activity.cs
- XAMLParseException.cs
- DbConnectionPoolIdentity.cs
- PathStreamGeometryContext.cs
- DbgUtil.cs
- RightsManagementPermission.cs
- OpenTypeLayout.cs
- CssStyleCollection.cs
- InheritedPropertyChangedEventArgs.cs
- HttpApplicationFactory.cs
- CodeDefaultValueExpression.cs
- ScopeCollection.cs
- ConfigurationLockCollection.cs
- FontWeights.cs
- SessionIDManager.cs
- Geometry3D.cs
- ClientTarget.cs
- ToolBar.cs
- FloatMinMaxAggregationOperator.cs
- ParameterBuilder.cs
- FieldAccessException.cs
- OverflowException.cs
- ConsumerConnectionPoint.cs
- VerificationException.cs
- DictionaryMarkupSerializer.cs
- ExpandedWrapper.cs
- HttpListenerException.cs
- QueryServiceConfigHandle.cs
- TextEditor.cs
- WindowsEditBox.cs
- DesignerCategoryAttribute.cs
- DatagridviewDisplayedBandsData.cs
- OrderByQueryOptionExpression.cs
- ToolBarPanel.cs
- StringAttributeCollection.cs
- ServiceModelDictionary.cs
- DefaultTraceListener.cs
- StubHelpers.cs
- PTProvider.cs
- ContentElementCollection.cs
- RegexMatchCollection.cs
- X509Certificate.cs
- HtmlShim.cs
- StorageEntityTypeMapping.cs
- Gdiplus.cs
- FakeModelPropertyImpl.cs
- _LocalDataStore.cs
- Typography.cs
- ContentPosition.cs
- CfgRule.cs
- TrackBarRenderer.cs
- XmlSchemas.cs
- ObjectDataSourceMethodEventArgs.cs
- Freezable.cs
- AsymmetricKeyExchangeDeformatter.cs
- IISUnsafeMethods.cs
- ResourceProperty.cs
- PeerNameRecord.cs
- BigInt.cs
- TextTreeTextBlock.cs
- WindowsTab.cs
- Screen.cs
- WebPartVerb.cs
- NativeMethodsCLR.cs
- webbrowsersite.cs
- SecurityManager.cs
- AsyncCompletedEventArgs.cs
- ACE.cs
- CodeCompileUnit.cs
- ResizeBehavior.cs
- CellIdBoolean.cs