Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Scripting / Actions / UnaryOperationBinder.cs / 1305376 / UnaryOperationBinder.cs
/* **************************************************************************** * * Copyright (c) Microsoft Corporation. * * This source code is subject to terms and conditions of the Microsoft Public License. A * copy of the license can be found in the License.html file at the root of this distribution. If * you cannot locate the Microsoft Public License, please send an email to * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound * by the terms of the Microsoft Public License. * * You must not remove this notice, or any other, from this software. * * * ***************************************************************************/ using System.Dynamic.Utils; using System.Linq.Expressions; namespace System.Dynamic { ////// Represents the unary dynamic operation at the call site, providing the binding semantic and the details about the operation. /// public abstract class UnaryOperationBinder : DynamicMetaObjectBinder { private ExpressionType _operation; ////// Initializes a new instance of the /// The unary operation kind. protected UnaryOperationBinder(ExpressionType operation) { ContractUtils.Requires(OperationIsValid(operation), "operation"); _operation = operation; } ///class. /// /// The result type of the operation. /// public override sealed Type ReturnType { get { switch(_operation) { case ExpressionType.IsFalse: case ExpressionType.IsTrue: return typeof(bool); default: return typeof(object); } } } ////// The unary operation kind. /// public ExpressionType Operation { get { return _operation; } } ////// Performs the binding of the unary dynamic operation if the target dynamic object cannot bind. /// /// The target of the dynamic unary operation. ///The public DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target) { return FallbackUnaryOperation(target, null); } ///representing the result of the binding. /// Performs the binding of the unary dynamic operation if the target dynamic object cannot bind. /// /// The target of the dynamic unary operation. /// The binding result in case the binding fails, or null. ///The public abstract DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target, DynamicMetaObject errorSuggestion); ///representing the result of the binding. /// Performs the binding of the dynamic unary operation. /// /// The target of the dynamic operation. /// An array of arguments of the dynamic operation. ///The public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { ContractUtils.RequiresNotNull(target, "target"); ContractUtils.Requires(args == null || args.Length == 0, "args"); return target.BindUnaryOperation(this); } // this is a standard DynamicMetaObjectBinder internal override sealed bool IsStandardBinder { get { return true; } } internal static bool OperationIsValid(ExpressionType operation) { switch (operation) { #region Generated Unary Operation Binder Validator // *** BEGIN GENERATED CODE *** // generated by function: gen_unop_validator from: generate_tree.py case ExpressionType.Negate: case ExpressionType.UnaryPlus: case ExpressionType.Not: case ExpressionType.Decrement: case ExpressionType.Increment: case ExpressionType.OnesComplement: case ExpressionType.IsTrue: case ExpressionType.IsFalse: // *** END GENERATED CODE *** #endregion case ExpressionType.Extension: return true; default: return false; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.representing the result of the binding.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Assert.cs
- DataGridViewRowCollection.cs
- SqlDataSourceStatusEventArgs.cs
- Crypto.cs
- EventLogPermissionEntry.cs
- WebPartUtil.cs
- SizeLimitedCache.cs
- NumericUpDownAcceleration.cs
- TypeValidationEventArgs.cs
- ToolStripContainer.cs
- StorageAssociationSetMapping.cs
- SafeReversePInvokeHandle.cs
- _ScatterGatherBuffers.cs
- TextLineResult.cs
- ErrorFormatter.cs
- EntityDataSourceDesigner.cs
- XmlSigningNodeWriter.cs
- StateBag.cs
- WebPartTransformer.cs
- WasEndpointConfigContainer.cs
- ExpressionCopier.cs
- SessionState.cs
- TextRangeEdit.cs
- ItemAutomationPeer.cs
- MessageSecurityTokenVersion.cs
- DataSetFieldSchema.cs
- WindowsHyperlink.cs
- OleDbConnectionFactory.cs
- CompositionAdorner.cs
- FamilyTypeface.cs
- InternalDispatchObject.cs
- CustomDictionarySources.cs
- SymDocumentType.cs
- SoapAttributeAttribute.cs
- ObjectResult.cs
- CodeParameterDeclarationExpression.cs
- PtsHost.cs
- XmlSchema.cs
- BasicDesignerLoader.cs
- DynamicILGenerator.cs
- ClientSettingsStore.cs
- FlowDocumentFormatter.cs
- ProfileManager.cs
- SynchronizingStream.cs
- StorageMappingItemLoader.cs
- BitVector32.cs
- XslAst.cs
- QueryInterceptorAttribute.cs
- RoleManagerSection.cs
- FrameworkReadOnlyPropertyMetadata.cs
- ButtonFlatAdapter.cs
- ActionItem.cs
- StylusCaptureWithinProperty.cs
- LogEntryHeaderv1Deserializer.cs
- AsyncResult.cs
- WizardForm.cs
- AutomationPatternInfo.cs
- HtmlInputButton.cs
- Compiler.cs
- DataGridViewColumnStateChangedEventArgs.cs
- AutomationPropertyInfo.cs
- MeasureItemEvent.cs
- TextSegment.cs
- SecurityState.cs
- DtdParser.cs
- NameSpaceEvent.cs
- GridItem.cs
- ComboBoxItem.cs
- DllNotFoundException.cs
- ComplusTypeValidator.cs
- ProcessHostFactoryHelper.cs
- XmlSchemaComplexContent.cs
- MarkerProperties.cs
- HtmlTableCellCollection.cs
- TemplateParser.cs
- Dump.cs
- HttpStreamFormatter.cs
- DirectoryObjectSecurity.cs
- CodeGroup.cs
- LambdaCompiler.ControlFlow.cs
- RefType.cs
- FilteredDataSetHelper.cs
- x509store.cs
- WizardStepBase.cs
- DependencyObjectValidator.cs
- HandlerMappingMemo.cs
- ObjectSet.cs
- VectorAnimationBase.cs
- AutoCompleteStringCollection.cs
- xdrvalidator.cs
- Currency.cs
- GlobalAclOperationRequirement.cs
- HotSpot.cs
- SolidColorBrush.cs
- SettingsPropertyIsReadOnlyException.cs
- MachineKeyValidationConverter.cs
- XmlMembersMapping.cs
- InvalidWorkflowException.cs
- PasswordDeriveBytes.cs
- DataTableReaderListener.cs