The Labs \ Source Viewer \ SSCLI \ System.Reflection \ Binder

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. ////////////////////////////////////////////////////////////////////////////////
  16. //
  17. // This interface defines a set of methods which interact with reflection
  18. // during the binding process. This control allows systems to apply language
  19. // specific semantics to the binding and invocation process.
  20. //
  21. // Date: June 98
  22. //
  23. namespace System.Reflection
  24. {
  25.     using System;
  26.     using System.Runtime.InteropServices;
  27.     using CultureInfo = System.Globalization.CultureInfo;
  28.    
  29.     [Serializable()]
  30.     [ClassInterface(ClassInterfaceType.AutoDual)]
  31.     [System.Runtime.InteropServices.ComVisible(true)]
  32.     public abstract class Binder
  33.     {
  34.         // Given a set of methods that match the basic criteria, select a method to
  35.         // invoke. When this method is finished, we should have
  36.         public abstract MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state);
  37.        
  38.         // Given a set of methods that match the basic criteria, select a method to
  39.         // invoke. When this method is finished, we should have
  40.         public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture);
  41.        
  42.         // Given a set of methods that match the base criteria, select a method based
  43.         // upon an array of types. This method should return null if no method matchs
  44.         // the criteria.
  45.         public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers);
  46.        
  47.        
  48.         // Given a set of propreties that match the base criteria, select one.
  49.         public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers);
  50.        
  51.         // ChangeType
  52.         // This method will convert the value into the property type.
  53.         // It throws a cast exception if this fails.
  54.         public abstract object ChangeType(object value, Type type, CultureInfo culture);
  55.        
  56.         public abstract void ReorderArgumentArray(ref object[] args, object state);
  57.        
  58.         // CanChangeType
  59.         // This method checks whether the value can be converted into the property type.
  60.         public virtual bool CanChangeType(object value, Type type, CultureInfo culture)
  61.         {
  62.             return false;
  63.         }
  64.     }
  65. }

Developer Fusion