IReflect.cs 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Globalization;
  5. namespace System.Reflection
  6. {
  7. public interface IReflect
  8. {
  9. // Return the requested method if it is implemented by the Reflection object. The
  10. // match is based upon the name and DescriptorInfo which describes the signature
  11. // of the method.
  12. MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers);
  13. // Return the requested method if it is implemented by the Reflection object. The
  14. // match is based upon the name of the method. If the object implementes multiple methods
  15. // with the same name an AmbiguousMatchException is thrown.
  16. MethodInfo GetMethod(string name, BindingFlags bindingAttr);
  17. MethodInfo[] GetMethods(BindingFlags bindingAttr);
  18. // Return the requestion field if it is implemented by the Reflection object. The
  19. // match is based upon a name. There cannot be more than a single field with
  20. // a name.
  21. FieldInfo GetField(string name, BindingFlags bindingAttr);
  22. FieldInfo[] GetFields(BindingFlags bindingAttr);
  23. // Return the property based upon name. If more than one property has the given
  24. // name an AmbiguousMatchException will be thrown. Returns null if no property
  25. // is found.
  26. PropertyInfo GetProperty(string name, BindingFlags bindingAttr);
  27. // Return the property based upon the name and Descriptor info describing the property
  28. // indexing. Return null if no property is found.
  29. PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
  30. // Returns an array of PropertyInfos for all the properties defined on
  31. // the Reflection object.
  32. PropertyInfo[] GetProperties(BindingFlags bindingAttr);
  33. // Return an array of members which match the passed in name.
  34. MemberInfo[] GetMember(string name, BindingFlags bindingAttr);
  35. // Return an array of all of the members defined for this object.
  36. MemberInfo[] GetMembers(BindingFlags bindingAttr);
  37. // Description of the Binding Process.
  38. // We must invoke a method that is accessible and for which the provided
  39. // parameters have the most specific match. A method may be called if
  40. // 1. The number of parameters in the method declaration equals the number of
  41. // arguments provided to the invocation
  42. // 2. The type of each argument can be converted by the binder to the
  43. // type of the type of the parameter.
  44. //
  45. // The binder will find all of the matching methods. These method are found based
  46. // upon the type of binding requested (MethodInvoke, Get/Set Properties). The set
  47. // of methods is filtered by the name, number of arguments and a set of search modifiers
  48. // defined in the Binder.
  49. //
  50. // After the method is selected, it will be invoked. Accessibility is checked
  51. // at that point. The search may be control which set of methods are searched based
  52. // upon the accessibility attribute associated with the method.
  53. //
  54. // The BindToMethod method is responsible for selecting the method to be invoked.
  55. // For the default binder, the most specific method will be selected.
  56. //
  57. // This will invoke a specific member...
  58. object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters);
  59. // Return the underlying Type that represents the IReflect Object. For expando object,
  60. // this is the (Object) IReflectInstance.GetType(). For Type object it is this.
  61. Type UnderlyingSystemType { get; }
  62. }
  63. }