Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / Microsoft / Scripting / Actions / ConvertBinder.cs / 1305376 / ConvertBinder.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; namespace System.Dynamic { ////// Represents the convert dynamic operation at the call site, providing the binding semantic and the details about the operation. /// public abstract class ConvertBinder : DynamicMetaObjectBinder { private readonly Type _type; private readonly bool _explicit; ////// Initializes a new intsance of the /// The type to convert to. /// true if the conversion should consider explicit conversions; otherwise, false. protected ConvertBinder(Type type, bool @explicit) { ContractUtils.RequiresNotNull(type, "type"); _type = type; _explicit = @explicit; } ///. /// /// The type to convert to. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] public Type Type { get { return _type; } } ////// Gets the value indicating if the conversion should consider explicit conversions. /// public bool Explicit { get { return _explicit; } } ////// Performs the binding of the dynamic convert operation if the target dynamic object cannot bind. /// /// The target of the dynamic convert operation. ///The public DynamicMetaObject FallbackConvert(DynamicMetaObject target) { return FallbackConvert(target, null); } ///representing the result of the binding. /// When overridden in the derived class, performs the binding of the dynamic convert operation if the target dynamic object cannot bind. /// /// The target of the dynamic convert operation. /// The binding result to use if binding fails, or null. ///The public abstract DynamicMetaObject FallbackConvert(DynamicMetaObject target, DynamicMetaObject errorSuggestion); ///representing the result of the binding. /// Performs the binding of the dynamic convert operation. /// /// The target of the dynamic convert operation. /// An array of arguments of the dynamic convert 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.BindConvert(this); } // this is a standard DynamicMetaObjectBinder internal override sealed bool IsStandardBinder { get { return true; } } ///representing the result of the binding. /// The result type of the operation. /// public override sealed Type ReturnType { get { return _type; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. /* **************************************************************************** * * 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; namespace System.Dynamic { ////// Represents the convert dynamic operation at the call site, providing the binding semantic and the details about the operation. /// public abstract class ConvertBinder : DynamicMetaObjectBinder { private readonly Type _type; private readonly bool _explicit; ////// Initializes a new intsance of the /// The type to convert to. /// true if the conversion should consider explicit conversions; otherwise, false. protected ConvertBinder(Type type, bool @explicit) { ContractUtils.RequiresNotNull(type, "type"); _type = type; _explicit = @explicit; } ///. /// /// The type to convert to. /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] public Type Type { get { return _type; } } ////// Gets the value indicating if the conversion should consider explicit conversions. /// public bool Explicit { get { return _explicit; } } ////// Performs the binding of the dynamic convert operation if the target dynamic object cannot bind. /// /// The target of the dynamic convert operation. ///The public DynamicMetaObject FallbackConvert(DynamicMetaObject target) { return FallbackConvert(target, null); } ///representing the result of the binding. /// When overridden in the derived class, performs the binding of the dynamic convert operation if the target dynamic object cannot bind. /// /// The target of the dynamic convert operation. /// The binding result to use if binding fails, or null. ///The public abstract DynamicMetaObject FallbackConvert(DynamicMetaObject target, DynamicMetaObject errorSuggestion); ///representing the result of the binding. /// Performs the binding of the dynamic convert operation. /// /// The target of the dynamic convert operation. /// An array of arguments of the dynamic convert 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.BindConvert(this); } // this is a standard DynamicMetaObjectBinder internal override sealed bool IsStandardBinder { get { return true; } } ///representing the result of the binding. /// The result type of the operation. /// public override sealed Type ReturnType { get { return _type; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConsoleKeyInfo.cs
- NetStream.cs
- DoubleLinkList.cs
- PreviewPrintController.cs
- DesigntimeLicenseContextSerializer.cs
- MailDefinition.cs
- DefinitionBase.cs
- AssociationTypeEmitter.cs
- HtmlForm.cs
- WizardPanel.cs
- AsyncDataRequest.cs
- ParserOptions.cs
- SQLInt32Storage.cs
- WSSecurityTokenSerializer.cs
- UriSectionData.cs
- SafePointer.cs
- _NestedMultipleAsyncResult.cs
- XmlNamespaceDeclarationsAttribute.cs
- FileChangesMonitor.cs
- RequestQueryParser.cs
- PartialCachingAttribute.cs
- Bidi.cs
- CompilerCollection.cs
- OleDbPermission.cs
- TransportBindingElementImporter.cs
- ListBox.cs
- GeneratedCodeAttribute.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- QuadraticBezierSegment.cs
- IPEndPointCollection.cs
- FamilyTypefaceCollection.cs
- ClientScriptManagerWrapper.cs
- WpfPayload.cs
- ResourceDictionaryCollection.cs
- EnlistmentState.cs
- Condition.cs
- LogicalExpr.cs
- ProjectionPruner.cs
- HashCodeCombiner.cs
- DataGridViewUtilities.cs
- EntitySqlQueryCacheKey.cs
- ElementHostAutomationPeer.cs
- ObjectDataSourceSelectingEventArgs.cs
- WindowShowOrOpenTracker.cs
- ListBindingHelper.cs
- TraceListeners.cs
- ToolStripKeyboardHandlingService.cs
- ToolStripComboBox.cs
- XmlUnspecifiedAttribute.cs
- RSAOAEPKeyExchangeDeformatter.cs
- FormViewCommandEventArgs.cs
- QilScopedVisitor.cs
- StringArrayConverter.cs
- Misc.cs
- BamlWriter.cs
- Privilege.cs
- DataGridViewColumnEventArgs.cs
- GregorianCalendar.cs
- BadImageFormatException.cs
- StringAnimationBase.cs
- SQLBinaryStorage.cs
- _NestedMultipleAsyncResult.cs
- JoinSymbol.cs
- ExpressionBuilder.cs
- XhtmlBasicTextViewAdapter.cs
- WebUtil.cs
- ServiceProviders.cs
- ISCIIEncoding.cs
- ToolStripOverflowButton.cs
- TextBreakpoint.cs
- SessionIDManager.cs
- Model3DCollection.cs
- LayoutTable.cs
- StrokeNodeData.cs
- HttpCachePolicy.cs
- HttpValueCollection.cs
- VectorConverter.cs
- SHA1.cs
- ObjectItemCollection.cs
- Normalization.cs
- PropVariant.cs
- Freezable.cs
- DataBindingList.cs
- EdmComplexPropertyAttribute.cs
- TriggerCollection.cs
- ManualResetEvent.cs
- HMACRIPEMD160.cs
- DocumentViewerAutomationPeer.cs
- CaseExpr.cs
- NullableLongAverageAggregationOperator.cs
- TextTabProperties.cs
- XPathDocumentNavigator.cs
- Grant.cs
- RegexWorker.cs
- HuffModule.cs
- TextBounds.cs
- DbDataReader.cs
- TemplateContentLoader.cs
- ForeignConstraint.cs
- MsmqException.cs