Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide reflection additions introduced for Windows Store #111079

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

namespace System.Reflection
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static partial class RuntimeReflectionExtensions
{
private const BindingFlags Everything = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;

[EditorBrowsable(EditorBrowsableState.Never)]
public static IEnumerable<FieldInfo> GetRuntimeFields(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)]
this Type type)
Expand All @@ -19,6 +22,7 @@ public static IEnumerable<FieldInfo> GetRuntimeFields(
return type.GetFields(Everything);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static IEnumerable<MethodInfo> GetRuntimeMethods(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
this Type type)
Expand All @@ -28,6 +32,7 @@ public static IEnumerable<MethodInfo> GetRuntimeMethods(
return type.GetMethods(Everything);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static IEnumerable<PropertyInfo> GetRuntimeProperties(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)]
this Type type)
Expand All @@ -37,6 +42,7 @@ public static IEnumerable<PropertyInfo> GetRuntimeProperties(
return type.GetProperties(Everything);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static IEnumerable<EventInfo> GetRuntimeEvents(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)]
this Type type)
Expand All @@ -46,6 +52,7 @@ public static IEnumerable<EventInfo> GetRuntimeEvents(
return type.GetEvents(Everything);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static FieldInfo? GetRuntimeField(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)]
this Type type, string name)
Expand All @@ -55,6 +62,7 @@ public static IEnumerable<EventInfo> GetRuntimeEvents(
return type.GetField(name);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static MethodInfo? GetRuntimeMethod(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
this Type type, string name, Type[] parameters)
Expand All @@ -64,6 +72,7 @@ public static IEnumerable<EventInfo> GetRuntimeEvents(
return type.GetMethod(name, parameters);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static PropertyInfo? GetRuntimeProperty(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
this Type type, string name)
Expand All @@ -73,6 +82,7 @@ public static IEnumerable<EventInfo> GetRuntimeEvents(
return type.GetProperty(name);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static EventInfo? GetRuntimeEvent(
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents)]
this Type type, string name)
Expand All @@ -82,20 +92,23 @@ public static IEnumerable<EventInfo> GetRuntimeEvents(
return type.GetEvent(name);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static MethodInfo? GetRuntimeBaseDefinition(this MethodInfo method)
{
ArgumentNullException.ThrowIfNull(method);

return method.GetBaseDefinition();
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static InterfaceMapping GetRuntimeInterfaceMap(this TypeInfo typeInfo, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
{
ArgumentNullException.ThrowIfNull(typeInfo);

return typeInfo.GetInterfaceMap(interfaceType);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static MethodInfo GetMethodInfo(this Delegate del)
{
ArgumentNullException.ThrowIfNull(del);
Expand Down
Loading
Loading