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
- CellConstant.cs
- RegistrationServices.cs
- UriParserTemplates.cs
- SoundPlayer.cs
- ToolboxDataAttribute.cs
- JavascriptXmlWriterWrapper.cs
- FunctionUpdateCommand.cs
- MessageBox.cs
- SiteMapHierarchicalDataSourceView.cs
- BindingMAnagerBase.cs
- basevalidator.cs
- PersonalizationStateQuery.cs
- AesManaged.cs
- SerializableAttribute.cs
- WebHttpElement.cs
- GridViewRowEventArgs.cs
- CatalogZoneBase.cs
- OleTxTransaction.cs
- MembershipUser.cs
- Helpers.cs
- TextRunCacheImp.cs
- webclient.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- CodeExpressionCollection.cs
- CatalogZoneBase.cs
- KeyValueSerializer.cs
- ConfigurationValidatorBase.cs
- SudsCommon.cs
- CompilationAssemblyInstallComponent.cs
- RawStylusInputReport.cs
- PerspectiveCamera.cs
- Clock.cs
- CacheMemory.cs
- sqlstateclientmanager.cs
- NavigatorOutput.cs
- EntityDesignerUtils.cs
- CommandID.cs
- ConfigurationSettings.cs
- GenericAuthenticationEventArgs.cs
- CultureSpecificStringDictionary.cs
- ListViewGroupConverter.cs
- Point4D.cs
- InstanceDataCollectionCollection.cs
- DBSchemaTable.cs
- ObjectKeyFrameCollection.cs
- BlockUIContainer.cs
- columnmapkeybuilder.cs
- oledbconnectionstring.cs
- SoundPlayer.cs
- ColorMatrix.cs
- GAC.cs
- XmlQualifiedNameTest.cs
- ReplyChannel.cs
- BatchStream.cs
- MetaModel.cs
- Wizard.cs
- SpeakInfo.cs
- TextRunCacheImp.cs
- PathTooLongException.cs
- BigInt.cs
- ConnectionsZone.cs
- NotEqual.cs
- ClrPerspective.cs
- CubicEase.cs
- QilTernary.cs
- Localizer.cs
- AttachedAnnotationChangedEventArgs.cs
- AlgoModule.cs
- BaseValidator.cs
- VariantWrapper.cs
- AutomationPeer.cs
- FormParameter.cs
- SetterBaseCollection.cs
- DataAdapter.cs
- HtmlInputReset.cs
- ConsoleTraceListener.cs
- PersonalizableTypeEntry.cs
- ReaderOutput.cs
- XmlObjectSerializerReadContextComplex.cs
- ObjectDataSourceWizardForm.cs
- PlatformCulture.cs
- FormViewPagerRow.cs
- PropertyEmitterBase.cs
- AdCreatedEventArgs.cs
- BooleanSwitch.cs
- IDReferencePropertyAttribute.cs
- RadioButtonList.cs
- ToolStripSystemRenderer.cs
- RequestTimeoutManager.cs
- HtmlFormParameterReader.cs
- PinnedBufferMemoryStream.cs
- GlyphRun.cs
- AuthorizationRuleCollection.cs
- ApplicationHost.cs
- PointHitTestResult.cs
- HttpHostedTransportConfiguration.cs
- ControlAdapter.cs
- PreservationFileReader.cs
- WebPartDisplayMode.cs
- DataGridViewLinkColumn.cs