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

WIP: add trimming support #917

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
annotate ReflectionUtility
zivillian committed Mar 25, 2024
commit 91e2fa3d45143222dd2146b74f788845207ca292
13 changes: 11 additions & 2 deletions YamlDotNet/Serialization/Utilities/ReflectionUtility.cs
Original file line number Diff line number Diff line change
@@ -21,12 +21,17 @@

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

namespace YamlDotNet.Serialization.Utilities
{
internal static class ReflectionUtility
{
public static Type? GetImplementedGenericInterface(Type type, Type genericInterfaceType)
public static Type? GetImplementedGenericInterface(
#if NET6_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
#endif
Type type, Type genericInterfaceType)
{
foreach (var interfacetype in GetImplementedInterfaces(type))
{
@@ -38,7 +43,11 @@ internal static class ReflectionUtility
return null;
}

public static IEnumerable<Type> GetImplementedInterfaces(Type type)
public static IEnumerable<Type> GetImplementedInterfaces(
#if NET6_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)]
#endif
Type type)
{
if (type.IsInterface())
{