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
- WindowVisualStateTracker.cs
- BooleanExpr.cs
- DateTimeStorage.cs
- UshortList2.cs
- HyperLinkColumn.cs
- TemplateBindingExtensionConverter.cs
- PackUriHelper.cs
- ContextMenu.cs
- autovalidator.cs
- QilParameter.cs
- SslStream.cs
- UriExt.cs
- SevenBitStream.cs
- MsmqIntegrationSecurityElement.cs
- SqlVersion.cs
- AnnouncementInnerClient11.cs
- XamlFrame.cs
- HitTestFilterBehavior.cs
- XPathSelectionIterator.cs
- MeasurementDCInfo.cs
- StrongNameMembershipCondition.cs
- _LocalDataStore.cs
- ProtocolsConfigurationEntry.cs
- ObjectDataSourceMethodEventArgs.cs
- WebPartConnectionsEventArgs.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- IndexedString.cs
- WebSysDefaultValueAttribute.cs
- TextServicesCompartmentEventSink.cs
- EditorPartChrome.cs
- ConfigPathUtility.cs
- FilteredAttributeCollection.cs
- ProtectedConfiguration.cs
- BasePropertyDescriptor.cs
- HttpAsyncResult.cs
- Transform3D.cs
- RegularExpressionValidator.cs
- Normalization.cs
- VirtualizingStackPanel.cs
- FilteredAttributeCollection.cs
- RegexInterpreter.cs
- JsonSerializer.cs
- SystemSounds.cs
- StrokeNodeEnumerator.cs
- MobileFormsAuthentication.cs
- CustomCredentialPolicy.cs
- TypeToken.cs
- TextRunCacheImp.cs
- HtmlHead.cs
- NeutralResourcesLanguageAttribute.cs
- TypeGeneratedEventArgs.cs
- BaseInfoTable.cs
- SmtpException.cs
- InternalEnumValidatorAttribute.cs
- HttpModuleActionCollection.cs
- FormsAuthenticationConfiguration.cs
- TrustLevelCollection.cs
- ScriptingJsonSerializationSection.cs
- ClientSettingsProvider.cs
- FontNameEditor.cs
- ObjectAssociationEndMapping.cs
- SortedDictionary.cs
- HMACSHA1.cs
- PkcsMisc.cs
- ConfigWriter.cs
- WindowsListViewSubItem.cs
- HandoffBehavior.cs
- Point4DConverter.cs
- WsatConfiguration.cs
- DataGridViewRowStateChangedEventArgs.cs
- SqlServer2KCompatibilityCheck.cs
- AspNetHostingPermission.cs
- ValuePattern.cs
- IMembershipProvider.cs
- WebBrowserNavigatingEventHandler.cs
- InternalSendMessage.cs
- SqlFacetAttribute.cs
- ZipFileInfoCollection.cs
- SqlReorderer.cs
- GradientStopCollection.cs
- PaintEvent.cs
- DateTimeParse.cs
- LogWriteRestartAreaState.cs
- DataGridViewComponentPropertyGridSite.cs
- CompilationRelaxations.cs
- Label.cs
- FormsAuthenticationModule.cs
- DPAPIProtectedConfigurationProvider.cs
- XmlSchemaAttributeGroupRef.cs
- X509CertificateClaimSet.cs
- FilterableAttribute.cs
- DeobfuscatingStream.cs
- ClientSettingsStore.cs
- GroupDescription.cs
- TaskFileService.cs
- FederatedMessageSecurityOverHttp.cs
- DateTimeConverter.cs
- SoapAttributes.cs
- EntityParameterCollection.cs
- BulletDecorator.cs