maint: Tidying up DefineConstants (#2538)

This commit is contained in:
Chris Simpson
2022-08-12 18:19:26 +01:00
committed by GitHub
parent b4ca7c7c57
commit 176bf386a0
36 changed files with 14 additions and 265 deletions
-11
View File
@@ -39,12 +39,6 @@ namespace Octokit
return type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
}
#if !HAS_TYPEINFO
public static Type GetTypeInfo(this Type type)
{
return type;
}
#else
public static IEnumerable<MemberInfo> GetMember(this Type type, string name)
{
return type.GetTypeInfo().DeclaredMembers.Where(m => m.Name == name);
@@ -59,19 +53,14 @@ namespace Octokit
{
return type.GetTypeInfo().IsAssignableFrom(otherType.GetTypeInfo());
}
#endif
public static IEnumerable<PropertyInfo> GetAllProperties(this Type type)
{
#if HAS_TYPEINFO
var typeInfo = type.GetTypeInfo();
var properties = typeInfo.DeclaredProperties;
var baseType = typeInfo.BaseType;
return baseType == null ? properties : properties.Concat(baseType.GetAllProperties());
#else
return type.GetProperties(BindingFlags.Instance | BindingFlags.Public);
#endif
}
public static bool IsEnumeration(this Type type)