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
- ContextTokenTypeConverter.cs
- SafeHandles.cs
- ConstNode.cs
- IdentityHolder.cs
- SapiRecoInterop.cs
- Size3D.cs
- AnimationStorage.cs
- ConditionalWeakTable.cs
- CryptoProvider.cs
- TemplatePropertyEntry.cs
- ListViewItemSelectionChangedEvent.cs
- XmlBinaryReader.cs
- PointHitTestParameters.cs
- DbDataReader.cs
- BaseParagraph.cs
- TimeEnumHelper.cs
- InputLanguage.cs
- ParserContext.cs
- RuntimeConfig.cs
- BroadcastEventHelper.cs
- NullableIntAverageAggregationOperator.cs
- SiteMapSection.cs
- SqlServer2KCompatibilityCheck.cs
- XmlReaderDelegator.cs
- HtmlInputHidden.cs
- SelectionChangedEventArgs.cs
- DbDataRecord.cs
- COM2TypeInfoProcessor.cs
- FontResourceCache.cs
- DataGridViewLayoutData.cs
- ItemsControlAutomationPeer.cs
- CryptoConfig.cs
- HtmlControl.cs
- TransactionOptions.cs
- SchemaAttDef.cs
- X509CertificateValidator.cs
- XmlSchema.cs
- ExpanderAutomationPeer.cs
- BevelBitmapEffect.cs
- LocalClientSecuritySettings.cs
- ClassHandlersStore.cs
- ErrorFormatterPage.cs
- Avt.cs
- CustomBindingElement.cs
- ArrayElementGridEntry.cs
- HScrollBar.cs
- LocalizationCodeDomSerializer.cs
- NewItemsContextMenuStrip.cs
- ObjectConverter.cs
- TextTreeText.cs
- NameValueSectionHandler.cs
- embossbitmapeffect.cs
- ImageMapEventArgs.cs
- SizeValueSerializer.cs
- MissingSatelliteAssemblyException.cs
- _CommandStream.cs
- XsltException.cs
- UInt32.cs
- EventSinkHelperWriter.cs
- ConnectionStringsSection.cs
- ConstraintCollection.cs
- ScrollEventArgs.cs
- Drawing.cs
- BamlBinaryWriter.cs
- UpdateCompiler.cs
- BooleanStorage.cs
- TextRangeEditTables.cs
- WorkflowExecutor.cs
- Model3D.cs
- CqlQuery.cs
- PathNode.cs
- HttpApplicationFactory.cs
- XmlTextWriter.cs
- TabPage.cs
- PnrpPeerResolverElement.cs
- CaseStatement.cs
- CardSpaceSelector.cs
- ReachDocumentPageSerializer.cs
- SqlTypesSchemaImporter.cs
- HandlerBase.cs
- Variable.cs
- EventHandlersStore.cs
- DispatcherFrame.cs
- ToolStripButton.cs
- IxmlLineInfo.cs
- CodeSnippetExpression.cs
- BoundField.cs
- ProcessProtocolHandler.cs
- RowToFieldTransformer.cs
- HttpsTransportBindingElement.cs
- ImageListStreamer.cs
- InfoCardRSAPKCS1KeyExchangeFormatter.cs
- PaintValueEventArgs.cs
- StreamUpdate.cs
- DataGridViewComboBoxCell.cs
- ServiceHttpHandlerFactory.cs
- EraserBehavior.cs
- Misc.cs
- HtmlForm.cs
- TextRangeEditLists.cs