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
- Journal.cs
- BindingBase.cs
- SqlCommandBuilder.cs
- TextLineBreak.cs
- ModelVisual3D.cs
- InternalTransaction.cs
- _Events.cs
- DirectionalAction.cs
- FilePresentation.cs
- IDictionary.cs
- IOException.cs
- DrawToolTipEventArgs.cs
- Stream.cs
- SafeHandles.cs
- XPathQueryGenerator.cs
- WebBrowser.cs
- FlagsAttribute.cs
- listviewsubitemcollectioneditor.cs
- AdRotator.cs
- RequiredFieldValidator.cs
- VariantWrapper.cs
- LoadedOrUnloadedOperation.cs
- CustomAttributeSerializer.cs
- CustomSignedXml.cs
- CommandExpr.cs
- Math.cs
- TransformedBitmap.cs
- SqlDataSource.cs
- RealizationContext.cs
- HtmlLink.cs
- SequenceDesignerAccessibleObject.cs
- SmiEventStream.cs
- PreProcessor.cs
- CodeDirectionExpression.cs
- AlignmentXValidation.cs
- ExtensionElementCollection.cs
- WriteableBitmap.cs
- TemplateBaseAction.cs
- SerializationException.cs
- PropertyEntry.cs
- StyleHelper.cs
- HashMembershipCondition.cs
- MD5.cs
- _CacheStreams.cs
- ListBoxItemAutomationPeer.cs
- WindowsGraphicsCacheManager.cs
- StateDesigner.LayoutSelectionGlyph.cs
- RootProfilePropertySettingsCollection.cs
- COM2Enum.cs
- LogWriteRestartAreaAsyncResult.cs
- RefreshEventArgs.cs
- AudioLevelUpdatedEventArgs.cs
- CaseInsensitiveHashCodeProvider.cs
- WebPartCatalogCloseVerb.cs
- IpcChannel.cs
- StrictModeSecurityHeaderElementInferenceEngine.cs
- DateTimeFormatInfoScanner.cs
- XmlNodeReader.cs
- DoubleLinkListEnumerator.cs
- DecimalFormatter.cs
- dsa.cs
- CryptoApi.cs
- RoutedCommand.cs
- DataServiceKeyAttribute.cs
- SqlDataSourceSelectingEventArgs.cs
- StaticDataManager.cs
- DeviceContext.cs
- GridViewSelectEventArgs.cs
- ObjectItemCachedAssemblyLoader.cs
- ValueTypeIndexerReference.cs
- Expression.DebuggerProxy.cs
- cookiecontainer.cs
- TextDecoration.cs
- SqlMethods.cs
- SqlUdtInfo.cs
- BitmapData.cs
- ValueSerializer.cs
- TypeBuilderInstantiation.cs
- DESCryptoServiceProvider.cs
- ConfigPathUtility.cs
- AspNetCompatibilityRequirementsMode.cs
- PenContext.cs
- VectorCollection.cs
- MouseBinding.cs
- ScopeCompiler.cs
- StreamGeometryContext.cs
- EventLogEntryCollection.cs
- IODescriptionAttribute.cs
- RightsManagementPermission.cs
- DataObjectCopyingEventArgs.cs
- BitmapEffectState.cs
- OutputCacheProfileCollection.cs
- ConfigurationStrings.cs
- AuthStoreRoleProvider.cs
- DirectoryInfo.cs
- RawTextInputReport.cs
- OracleParameterCollection.cs
- MediaContext.cs
- CompressedStack.cs
- Opcode.cs