Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d2a3012

Browse files
atsushikansafern
authored andcommitted
Move IReflect.cs to shared partition. (dotnet/coreclr#10415)
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
1 parent 6b1a317 commit d2a3012

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

src/Common/src/CoreLib/System.Private.CoreLib.Shared.projitems

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ConstructorInfo.cs" />
161161
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\EventInfo.cs" />
162162
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\FieldInfo.cs" />
163+
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\IReflect.cs" />
163164
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MemberInfo.cs" />
164165
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodInfo.cs" />
165166
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodBase.cs" />
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
5+
using System.Globalization;
6+
7+
namespace System.Reflection
8+
{
9+
public interface IReflect
10+
{
11+
// Return the requested method if it is implemented by the Reflection object. The
12+
// match is based upon the name and DescriptorInfo which describes the signature
13+
// of the method.
14+
MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers);
15+
16+
// Return the requested method if it is implemented by the Reflection object. The
17+
// match is based upon the name of the method. If the object implementes multiple methods
18+
// with the same name an AmbiguousMatchException is thrown.
19+
MethodInfo GetMethod(string name, BindingFlags bindingAttr);
20+
21+
MethodInfo[] GetMethods(BindingFlags bindingAttr);
22+
23+
// Return the requestion field if it is implemented by the Reflection object. The
24+
// match is based upon a name. There cannot be more than a single field with
25+
// a name.
26+
FieldInfo GetField(string name, BindingFlags bindingAttr);
27+
28+
FieldInfo[] GetFields(BindingFlags bindingAttr);
29+
30+
// Return the property based upon name. If more than one property has the given
31+
// name an AmbiguousMatchException will be thrown. Returns null if no property
32+
// is found.
33+
PropertyInfo GetProperty(string name, BindingFlags bindingAttr);
34+
35+
// Return the property based upon the name and Descriptor info describing the property
36+
// indexing. Return null if no property is found.
37+
PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
38+
39+
// Returns an array of PropertyInfos for all the properties defined on
40+
// the Reflection object.
41+
PropertyInfo[] GetProperties(BindingFlags bindingAttr);
42+
43+
// Return an array of members which match the passed in name.
44+
MemberInfo[] GetMember(string name, BindingFlags bindingAttr);
45+
46+
// Return an array of all of the members defined for this object.
47+
MemberInfo[] GetMembers(BindingFlags bindingAttr);
48+
49+
// Description of the Binding Process.
50+
// We must invoke a method that is accessable and for which the provided
51+
// parameters have the most specific match. A method may be called if
52+
// 1. The number of parameters in the method declaration equals the number of
53+
// arguments provided to the invocation
54+
// 2. The type of each argument can be converted by the binder to the
55+
// type of the type of the parameter.
56+
//
57+
// The binder will find all of the matching methods. These method are found based
58+
// upon the type of binding requested (MethodInvoke, Get/Set Properties). The set
59+
// of methods is filtered by the name, number of arguments and a set of search modifiers
60+
// defined in the Binder.
61+
//
62+
// After the method is selected, it will be invoked. Accessability is checked
63+
// at that point. The search may be control which set of methods are searched based
64+
// upon the accessibility attribute associated with the method.
65+
//
66+
// The BindToMethod method is responsible for selecting the method to be invoked.
67+
// For the default binder, the most specific method will be selected.
68+
//
69+
// This will invoke a specific member...
70+
object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters);
71+
72+
// Return the underlying Type that represents the IReflect Object. For expando object,
73+
// this is the (Object) IReflectInstance.GetType(). For Type object it is this.
74+
Type UnderlyingSystemType { get; }
75+
}
76+
}

0 commit comments

Comments
 (0)