Smdn.Fundamental.Reflection version 3.5.0
smdn
released this
24 Dec 12:55
·
156 commits
to main
since this release
Released package
Release notes
The full release notes are available at gist.
Change log
Change log in this release:
- 2023-12-24 simplify conditional expression
- 2023-12-24 update assembly version
- 2023-12-24 add MethodInfo.IsReadOnly()/EventInfo.IsReadOnly()/PropertyInfo.IsAccessorReadOnly()
- 2023-12-24 add support for special methods for operators introduce in C# 11
- 2023-12-19 fix warning IDE1006: Naming rule violation
- 2023-12-19 fix warning IDE0055: Fix formatting
- 2023-12-19 disable warning CS1591
- 2023-05-11 delete unnecessary using directive
- 2023-05-11 discard return value
- 2023-05-11 compliant IDE0030; empty the root namespace so that the namespace is determined only by the directory name
- 2023-05-10 fix nullability
- 2023-05-10 validate the parameter is non-null before using it
- 2023-05-10 refactor
- 2023-05-10 delete dead codes
- 2023-04-19 bump Smdn.MSBuild.ProjectAssets.Library up to 1.5.0
API changes
API changes in this release:
diff --git a/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-net45.apilist.cs b/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-net45.apilist.cs
index 4b74ea55..88046e8b 100644
--- a/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-net45.apilist.cs
+++ b/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-net45.apilist.cs
@@ -1,143 +1,155 @@
-// Smdn.Fundamental.Reflection.dll (Smdn.Fundamental.Reflection-3.4.0)
+// Smdn.Fundamental.Reflection.dll (Smdn.Fundamental.Reflection-3.5.0)
// Name: Smdn.Fundamental.Reflection
-// AssemblyVersion: 3.4.0.0
-// InformationalVersion: 3.4.0+d21bbefe0b9d2b7ce768d8d377418d43aafc7e9a
+// AssemblyVersion: 3.5.0.0
+// InformationalVersion: 3.5.0+4c5047ad07bce4305c5e019010c8d404edb30d22
// TargetFramework: .NETFramework,Version=v4.5
// Configuration: Release
// Referenced assemblies:
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Reflection;
using Smdn.Reflection;
namespace Smdn.Reflection {
public enum Accessibility : int {
Assembly = 3,
Family = 4,
FamilyAndAssembly = 2,
FamilyOrAssembly = 5,
Private = 1,
Public = 6,
Undefined = 0,
}
public enum MethodSpecialName : int {
Addition = 16,
BitwiseAnd = 21,
BitwiseOr = 22,
+ CheckedAddition = 32,
+ CheckedDecrement = 31,
+ CheckedDivision = 35,
+ CheckedExplicit = 36,
+ CheckedIncrement = 30,
+ CheckedMultiply = 34,
+ CheckedSubtraction = 33,
+ CheckedUnaryNegation = 29,
Constructor = 1,
Decrement = 15,
Division = 19,
Equality = 2,
ExclusiveOr = 23,
Explicit = 26,
False = 13,
GreaterThan = 5,
GreaterThanOrEqual = 7,
Implicit = 27,
Increment = 14,
Inequality = 3,
LeftShift = 25,
LessThan = 4,
LessThanOrEqual = 6,
LogicalNot = 10,
Modulus = 20,
Multiply = 18,
None = 0,
OnesComplement = 11,
RightShift = 24,
Subtraction = 17,
True = 12,
UnaryNegation = 9,
UnaryPlus = 8,
Unknown = -1,
+ UnsignedRightShift = 28,
}
public static class EventInfoExtensions {
public static FieldInfo? GetBackingField(this EventInfo ev) {}
public static IEnumerable<MethodInfo> GetMethods(this EventInfo ev) {}
public static IEnumerable<MethodInfo> GetMethods(this EventInfo ev, bool nonPublic) {}
public static bool IsOverride(this EventInfo ev) {}
+ public static bool IsReadOnly(this EventInfo ev) {}
public static bool IsStatic(this EventInfo ev) {}
}
public static class FieldInfoExtensions {
public static bool IsEventBackingField(this FieldInfo f) {}
public static bool IsPropertyBackingField(this FieldInfo f) {}
public static bool TryGetEventFromBackingField(this FieldInfo backingField, out EventInfo? ev) {}
public static bool TryGetPropertyFromBackingField(this FieldInfo backingField, out PropertyInfo? property) {}
}
public static class MemberInfoExtensions {
public static Accessibility GetAccessibility(this MemberInfo member) {}
public static bool IsHidingInheritedMember(this MemberInfo member, bool nonPublic) {}
public static bool IsPrivateOrAssembly(this MemberInfo member) {}
}
public static class MethodBaseExtensions {
public static MethodInfo? FindExplicitInterfaceMethod(this MethodBase m, bool findOnlyPublicInterfaces = false) {}
public static MethodSpecialName GetNameType(this MethodBase m) {}
public static IEnumerable<Type> GetSignatureTypes(this MethodBase m) {}
public static bool IsExplicitlyImplemented(this MethodBase m) {}
public static bool TryFindExplicitInterfaceMethod(this MethodBase m, out MethodInfo? explicitInterfaceMethod, bool findOnlyPublicInterfaces = false) {}
}
public static class MethodInfoExtensions {
public static bool IsDelegateSignatureMethod(this MethodInfo m) {}
public static bool IsEventAccessorMethod(this MethodInfo m) {}
public static bool IsEventAddMethod(this MethodInfo m) {}
public static bool IsEventRemoveMethod(this MethodInfo m) {}
[Obsolete("use IsOverride instead")]
public static bool IsOverridden(this MethodInfo m) {}
public static bool IsOverride(this MethodInfo m) {}
public static bool IsPropertyAccessorMethod(this MethodInfo m) {}
public static bool IsPropertyGetMethod(this MethodInfo m) {}
public static bool IsPropertySetMethod(this MethodInfo m) {}
+ public static bool IsReadOnly(this MethodInfo m) {}
public static bool TryGetEventFromAccessorMethod(this MethodInfo? accessor, out EventInfo? ev) {}
public static bool TryGetPropertyFromAccessorMethod(this MethodInfo? accessor, out PropertyInfo? property) {}
}
public static class ParameterInfoExtensions {
public static EventInfo? GetDeclaringEvent(this ParameterInfo param) {}
public static PropertyInfo? GetDeclaringProperty(this ParameterInfo param) {}
public static bool IsReturnParameter(this ParameterInfo param) {}
}
public static class PropertyInfoExtensions {
public static FieldInfo? GetBackingField(this PropertyInfo property) {}
+ public static bool IsAccessorReadOnly(this PropertyInfo property) {}
public static bool IsOverride(this PropertyInfo property) {}
public static bool IsSetMethodInitOnly(this PropertyInfo property) {}
public static bool IsStatic(this PropertyInfo property) {}
}
public static class TypeExtensions {
public static MethodInfo? GetDelegateSignatureMethod(this Type t) {}
public static IEnumerable<Type> GetExplicitBaseTypeAndInterfaces(this Type t) {}
public static string GetGenericTypeName(this Type t) {}
public static IEnumerable<string> GetNamespaces(this Type t) {}
public static IEnumerable<string> GetNamespaces(this Type t, Func<Type, bool> isLanguagePrimitive) {}
public static bool IsByRefLikeValueType(this Type t) {}
public static bool IsConcreteDelegate(this Type t) {}
public static bool IsDelegate(this Type t) {}
public static bool IsEnumFlags(this Type t) {}
public static bool IsHidingInheritedType(this Type t, bool nonPublic) {}
public static bool IsReadOnlyValueType(this Type t) {}
public static bool IsStructLayoutDefault(this Type t) {}
}
}
namespace Smdn.Reflection.Attributes {
public static class CustomAttributeTypedArgumentExtensions {
public static object? GetTypedValue(this CustomAttributeTypedArgument typedArg) {}
}
public static class ICustomAttributeProviderExtensions {
public static IList<CustomAttributeData> GetCustomAttributeDataList(this ICustomAttributeProvider attributeProvider) {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.1.7.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.0.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-net6.0.apilist.cs b/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-net6.0.apilist.cs
index 7210cbcf..0f27e64a 100644
--- a/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-net6.0.apilist.cs
+++ b/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-net6.0.apilist.cs
@@ -1,145 +1,157 @@
-// Smdn.Fundamental.Reflection.dll (Smdn.Fundamental.Reflection-3.4.0)
+// Smdn.Fundamental.Reflection.dll (Smdn.Fundamental.Reflection-3.5.0)
// Name: Smdn.Fundamental.Reflection
-// AssemblyVersion: 3.4.0.0
-// InformationalVersion: 3.4.0+d21bbefe0b9d2b7ce768d8d377418d43aafc7e9a
+// AssemblyVersion: 3.5.0.0
+// InformationalVersion: 3.5.0+4c5047ad07bce4305c5e019010c8d404edb30d22
// TargetFramework: .NETCoreApp,Version=v6.0
// Configuration: Release
// Referenced assemblies:
// System.Collections, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Smdn.Reflection;
namespace Smdn.Reflection {
public enum Accessibility : int {
Assembly = 3,
Family = 4,
FamilyAndAssembly = 2,
FamilyOrAssembly = 5,
Private = 1,
Public = 6,
Undefined = 0,
}
public enum MethodSpecialName : int {
Addition = 16,
BitwiseAnd = 21,
BitwiseOr = 22,
+ CheckedAddition = 32,
+ CheckedDecrement = 31,
+ CheckedDivision = 35,
+ CheckedExplicit = 36,
+ CheckedIncrement = 30,
+ CheckedMultiply = 34,
+ CheckedSubtraction = 33,
+ CheckedUnaryNegation = 29,
Constructor = 1,
Decrement = 15,
Division = 19,
Equality = 2,
ExclusiveOr = 23,
Explicit = 26,
False = 13,
GreaterThan = 5,
GreaterThanOrEqual = 7,
Implicit = 27,
Increment = 14,
Inequality = 3,
LeftShift = 25,
LessThan = 4,
LessThanOrEqual = 6,
LogicalNot = 10,
Modulus = 20,
Multiply = 18,
None = 0,
OnesComplement = 11,
RightShift = 24,
Subtraction = 17,
True = 12,
UnaryNegation = 9,
UnaryPlus = 8,
Unknown = -1,
+ UnsignedRightShift = 28,
}
public static class EventInfoExtensions {
public static FieldInfo? GetBackingField(this EventInfo ev) {}
public static IEnumerable<MethodInfo> GetMethods(this EventInfo ev) {}
public static IEnumerable<MethodInfo> GetMethods(this EventInfo ev, bool nonPublic) {}
public static bool IsOverride(this EventInfo ev) {}
+ public static bool IsReadOnly(this EventInfo ev) {}
public static bool IsStatic(this EventInfo ev) {}
}
public static class FieldInfoExtensions {
public static bool IsEventBackingField(this FieldInfo f) {}
public static bool IsPropertyBackingField(this FieldInfo f) {}
public static bool TryGetEventFromBackingField(this FieldInfo backingField, [NotNullWhen(true)] out EventInfo? ev) {}
public static bool TryGetPropertyFromBackingField(this FieldInfo backingField, [NotNullWhen(true)] out PropertyInfo? property) {}
}
public static class MemberInfoExtensions {
public static Accessibility GetAccessibility(this MemberInfo member) {}
public static bool IsHidingInheritedMember(this MemberInfo member, bool nonPublic) {}
public static bool IsPrivateOrAssembly(this MemberInfo member) {}
}
public static class MethodBaseExtensions {
public static MethodInfo? FindExplicitInterfaceMethod(this MethodBase m, bool findOnlyPublicInterfaces = false) {}
public static MethodSpecialName GetNameType(this MethodBase m) {}
public static IEnumerable<Type> GetSignatureTypes(this MethodBase m) {}
public static bool IsExplicitlyImplemented(this MethodBase m) {}
public static bool TryFindExplicitInterfaceMethod(this MethodBase m, out MethodInfo? explicitInterfaceMethod, bool findOnlyPublicInterfaces = false) {}
}
public static class MethodInfoExtensions {
public static bool IsDelegateSignatureMethod(this MethodInfo m) {}
public static bool IsEventAccessorMethod(this MethodInfo m) {}
public static bool IsEventAddMethod(this MethodInfo m) {}
public static bool IsEventRemoveMethod(this MethodInfo m) {}
[Obsolete("use IsOverride instead")]
public static bool IsOverridden(this MethodInfo m) {}
public static bool IsOverride(this MethodInfo m) {}
public static bool IsPropertyAccessorMethod(this MethodInfo m) {}
public static bool IsPropertyGetMethod(this MethodInfo m) {}
public static bool IsPropertySetMethod(this MethodInfo m) {}
+ public static bool IsReadOnly(this MethodInfo m) {}
public static bool TryGetEventFromAccessorMethod(this MethodInfo? accessor, [NotNullWhen(true)] out EventInfo? ev) {}
public static bool TryGetPropertyFromAccessorMethod(this MethodInfo? accessor, [NotNullWhen(true)] out PropertyInfo? property) {}
}
public static class ParameterInfoExtensions {
public static EventInfo? GetDeclaringEvent(this ParameterInfo param) {}
public static PropertyInfo? GetDeclaringProperty(this ParameterInfo param) {}
public static bool IsReturnParameter(this ParameterInfo param) {}
}
public static class PropertyInfoExtensions {
public static FieldInfo? GetBackingField(this PropertyInfo property) {}
+ public static bool IsAccessorReadOnly(this PropertyInfo property) {}
public static bool IsOverride(this PropertyInfo property) {}
public static bool IsSetMethodInitOnly(this PropertyInfo property) {}
public static bool IsStatic(this PropertyInfo property) {}
}
public static class TypeExtensions {
public static MethodInfo? GetDelegateSignatureMethod(this Type t) {}
public static IEnumerable<Type> GetExplicitBaseTypeAndInterfaces(this Type t) {}
public static string GetGenericTypeName(this Type t) {}
public static IEnumerable<string> GetNamespaces(this Type t) {}
public static IEnumerable<string> GetNamespaces(this Type t, Func<Type, bool> isLanguagePrimitive) {}
public static bool IsByRefLikeValueType(this Type t) {}
public static bool IsConcreteDelegate(this Type t) {}
public static bool IsDelegate(this Type t) {}
public static bool IsEnumFlags(this Type t) {}
public static bool IsHidingInheritedType(this Type t, bool nonPublic) {}
public static bool IsReadOnlyValueType(this Type t) {}
public static bool IsStructLayoutDefault(this Type t) {}
}
}
namespace Smdn.Reflection.Attributes {
public static class CustomAttributeTypedArgumentExtensions {
public static object? GetTypedValue(this CustomAttributeTypedArgument typedArg) {}
}
public static class ICustomAttributeProviderExtensions {
public static IList<CustomAttributeData> GetCustomAttributeDataList(this ICustomAttributeProvider attributeProvider) {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.1.7.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.0.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-netstandard2.0.apilist.cs b/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-netstandard2.0.apilist.cs
index d0fcca24..e6643aea 100644
--- a/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-netstandard2.0.apilist.cs
+++ b/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-netstandard2.0.apilist.cs
@@ -1,142 +1,154 @@
-// Smdn.Fundamental.Reflection.dll (Smdn.Fundamental.Reflection-3.4.0)
+// Smdn.Fundamental.Reflection.dll (Smdn.Fundamental.Reflection-3.5.0)
// Name: Smdn.Fundamental.Reflection
-// AssemblyVersion: 3.4.0.0
-// InformationalVersion: 3.4.0+d21bbefe0b9d2b7ce768d8d377418d43aafc7e9a
+// AssemblyVersion: 3.5.0.0
+// InformationalVersion: 3.5.0+4c5047ad07bce4305c5e019010c8d404edb30d22
// TargetFramework: .NETStandard,Version=v2.0
// Configuration: Release
// Referenced assemblies:
// netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Reflection;
using Smdn.Reflection;
namespace Smdn.Reflection {
public enum Accessibility : int {
Assembly = 3,
Family = 4,
FamilyAndAssembly = 2,
FamilyOrAssembly = 5,
Private = 1,
Public = 6,
Undefined = 0,
}
public enum MethodSpecialName : int {
Addition = 16,
BitwiseAnd = 21,
BitwiseOr = 22,
+ CheckedAddition = 32,
+ CheckedDecrement = 31,
+ CheckedDivision = 35,
+ CheckedExplicit = 36,
+ CheckedIncrement = 30,
+ CheckedMultiply = 34,
+ CheckedSubtraction = 33,
+ CheckedUnaryNegation = 29,
Constructor = 1,
Decrement = 15,
Division = 19,
Equality = 2,
ExclusiveOr = 23,
Explicit = 26,
False = 13,
GreaterThan = 5,
GreaterThanOrEqual = 7,
Implicit = 27,
Increment = 14,
Inequality = 3,
LeftShift = 25,
LessThan = 4,
LessThanOrEqual = 6,
LogicalNot = 10,
Modulus = 20,
Multiply = 18,
None = 0,
OnesComplement = 11,
RightShift = 24,
Subtraction = 17,
True = 12,
UnaryNegation = 9,
UnaryPlus = 8,
Unknown = -1,
+ UnsignedRightShift = 28,
}
public static class EventInfoExtensions {
public static FieldInfo? GetBackingField(this EventInfo ev) {}
public static IEnumerable<MethodInfo> GetMethods(this EventInfo ev) {}
public static IEnumerable<MethodInfo> GetMethods(this EventInfo ev, bool nonPublic) {}
public static bool IsOverride(this EventInfo ev) {}
+ public static bool IsReadOnly(this EventInfo ev) {}
public static bool IsStatic(this EventInfo ev) {}
}
public static class FieldInfoExtensions {
public static bool IsEventBackingField(this FieldInfo f) {}
public static bool IsPropertyBackingField(this FieldInfo f) {}
public static bool TryGetEventFromBackingField(this FieldInfo backingField, out EventInfo? ev) {}
public static bool TryGetPropertyFromBackingField(this FieldInfo backingField, out PropertyInfo? property) {}
}
public static class MemberInfoExtensions {
public static Accessibility GetAccessibility(this MemberInfo member) {}
public static bool IsHidingInheritedMember(this MemberInfo member, bool nonPublic) {}
public static bool IsPrivateOrAssembly(this MemberInfo member) {}
}
public static class MethodBaseExtensions {
public static MethodInfo? FindExplicitInterfaceMethod(this MethodBase m, bool findOnlyPublicInterfaces = false) {}
public static MethodSpecialName GetNameType(this MethodBase m) {}
public static IEnumerable<Type> GetSignatureTypes(this MethodBase m) {}
public static bool IsExplicitlyImplemented(this MethodBase m) {}
public static bool TryFindExplicitInterfaceMethod(this MethodBase m, out MethodInfo? explicitInterfaceMethod, bool findOnlyPublicInterfaces = false) {}
}
public static class MethodInfoExtensions {
public static bool IsDelegateSignatureMethod(this MethodInfo m) {}
public static bool IsEventAccessorMethod(this MethodInfo m) {}
public static bool IsEventAddMethod(this MethodInfo m) {}
public static bool IsEventRemoveMethod(this MethodInfo m) {}
[Obsolete("use IsOverride instead")]
public static bool IsOverridden(this MethodInfo m) {}
public static bool IsOverride(this MethodInfo m) {}
public static bool IsPropertyAccessorMethod(this MethodInfo m) {}
public static bool IsPropertyGetMethod(this MethodInfo m) {}
public static bool IsPropertySetMethod(this MethodInfo m) {}
+ public static bool IsReadOnly(this MethodInfo m) {}
public static bool TryGetEventFromAccessorMethod(this MethodInfo? accessor, out EventInfo? ev) {}
public static bool TryGetPropertyFromAccessorMethod(this MethodInfo? accessor, out PropertyInfo? property) {}
}
public static class ParameterInfoExtensions {
public static EventInfo? GetDeclaringEvent(this ParameterInfo param) {}
public static PropertyInfo? GetDeclaringProperty(this ParameterInfo param) {}
public static bool IsReturnParameter(this ParameterInfo param) {}
}
public static class PropertyInfoExtensions {
public static FieldInfo? GetBackingField(this PropertyInfo property) {}
+ public static bool IsAccessorReadOnly(this PropertyInfo property) {}
public static bool IsOverride(this PropertyInfo property) {}
public static bool IsSetMethodInitOnly(this PropertyInfo property) {}
public static bool IsStatic(this PropertyInfo property) {}
}
public static class TypeExtensions {
public static MethodInfo? GetDelegateSignatureMethod(this Type t) {}
public static IEnumerable<Type> GetExplicitBaseTypeAndInterfaces(this Type t) {}
public static string GetGenericTypeName(this Type t) {}
public static IEnumerable<string> GetNamespaces(this Type t) {}
public static IEnumerable<string> GetNamespaces(this Type t, Func<Type, bool> isLanguagePrimitive) {}
public static bool IsByRefLikeValueType(this Type t) {}
public static bool IsConcreteDelegate(this Type t) {}
public static bool IsDelegate(this Type t) {}
public static bool IsEnumFlags(this Type t) {}
public static bool IsHidingInheritedType(this Type t, bool nonPublic) {}
public static bool IsReadOnlyValueType(this Type t) {}
public static bool IsStructLayoutDefault(this Type t) {}
}
}
namespace Smdn.Reflection.Attributes {
public static class CustomAttributeTypedArgumentExtensions {
public static object? GetTypedValue(this CustomAttributeTypedArgument typedArg) {}
}
public static class ICustomAttributeProviderExtensions {
public static IList<CustomAttributeData> GetCustomAttributeDataList(this ICustomAttributeProvider attributeProvider) {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.1.7.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.0.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-netstandard2.1.apilist.cs b/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-netstandard2.1.apilist.cs
index b9aa257e..5c4a3957 100644
--- a/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-netstandard2.1.apilist.cs
+++ b/doc/api-list/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection-netstandard2.1.apilist.cs
@@ -1,143 +1,155 @@
-// Smdn.Fundamental.Reflection.dll (Smdn.Fundamental.Reflection-3.4.0)
+// Smdn.Fundamental.Reflection.dll (Smdn.Fundamental.Reflection-3.5.0)
// Name: Smdn.Fundamental.Reflection
-// AssemblyVersion: 3.4.0.0
-// InformationalVersion: 3.4.0+d21bbefe0b9d2b7ce768d8d377418d43aafc7e9a
+// AssemblyVersion: 3.5.0.0
+// InformationalVersion: 3.5.0+4c5047ad07bce4305c5e019010c8d404edb30d22
// TargetFramework: .NETStandard,Version=v2.1
// Configuration: Release
// Referenced assemblies:
// netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Smdn.Reflection;
namespace Smdn.Reflection {
public enum Accessibility : int {
Assembly = 3,
Family = 4,
FamilyAndAssembly = 2,
FamilyOrAssembly = 5,
Private = 1,
Public = 6,
Undefined = 0,
}
public enum MethodSpecialName : int {
Addition = 16,
BitwiseAnd = 21,
BitwiseOr = 22,
+ CheckedAddition = 32,
+ CheckedDecrement = 31,
+ CheckedDivision = 35,
+ CheckedExplicit = 36,
+ CheckedIncrement = 30,
+ CheckedMultiply = 34,
+ CheckedSubtraction = 33,
+ CheckedUnaryNegation = 29,
Constructor = 1,
Decrement = 15,
Division = 19,
Equality = 2,
ExclusiveOr = 23,
Explicit = 26,
False = 13,
GreaterThan = 5,
GreaterThanOrEqual = 7,
Implicit = 27,
Increment = 14,
Inequality = 3,
LeftShift = 25,
LessThan = 4,
LessThanOrEqual = 6,
LogicalNot = 10,
Modulus = 20,
Multiply = 18,
None = 0,
OnesComplement = 11,
RightShift = 24,
Subtraction = 17,
True = 12,
UnaryNegation = 9,
UnaryPlus = 8,
Unknown = -1,
+ UnsignedRightShift = 28,
}
public static class EventInfoExtensions {
public static FieldInfo? GetBackingField(this EventInfo ev) {}
public static IEnumerable<MethodInfo> GetMethods(this EventInfo ev) {}
public static IEnumerable<MethodInfo> GetMethods(this EventInfo ev, bool nonPublic) {}
public static bool IsOverride(this EventInfo ev) {}
+ public static bool IsReadOnly(this EventInfo ev) {}
public static bool IsStatic(this EventInfo ev) {}
}
public static class FieldInfoExtensions {
public static bool IsEventBackingField(this FieldInfo f) {}
public static bool IsPropertyBackingField(this FieldInfo f) {}
public static bool TryGetEventFromBackingField(this FieldInfo backingField, [NotNullWhen(true)] out EventInfo? ev) {}
public static bool TryGetPropertyFromBackingField(this FieldInfo backingField, [NotNullWhen(true)] out PropertyInfo? property) {}
}
public static class MemberInfoExtensions {
public static Accessibility GetAccessibility(this MemberInfo member) {}
public static bool IsHidingInheritedMember(this MemberInfo member, bool nonPublic) {}
public static bool IsPrivateOrAssembly(this MemberInfo member) {}
}
public static class MethodBaseExtensions {
public static MethodInfo? FindExplicitInterfaceMethod(this MethodBase m, bool findOnlyPublicInterfaces = false) {}
public static MethodSpecialName GetNameType(this MethodBase m) {}
public static IEnumerable<Type> GetSignatureTypes(this MethodBase m) {}
public static bool IsExplicitlyImplemented(this MethodBase m) {}
public static bool TryFindExplicitInterfaceMethod(this MethodBase m, out MethodInfo? explicitInterfaceMethod, bool findOnlyPublicInterfaces = false) {}
}
public static class MethodInfoExtensions {
public static bool IsDelegateSignatureMethod(this MethodInfo m) {}
public static bool IsEventAccessorMethod(this MethodInfo m) {}
public static bool IsEventAddMethod(this MethodInfo m) {}
public static bool IsEventRemoveMethod(this MethodInfo m) {}
[Obsolete("use IsOverride instead")]
public static bool IsOverridden(this MethodInfo m) {}
public static bool IsOverride(this MethodInfo m) {}
public static bool IsPropertyAccessorMethod(this MethodInfo m) {}
public static bool IsPropertyGetMethod(this MethodInfo m) {}
public static bool IsPropertySetMethod(this MethodInfo m) {}
+ public static bool IsReadOnly(this MethodInfo m) {}
public static bool TryGetEventFromAccessorMethod(this MethodInfo? accessor, [NotNullWhen(true)] out EventInfo? ev) {}
public static bool TryGetPropertyFromAccessorMethod(this MethodInfo? accessor, [NotNullWhen(true)] out PropertyInfo? property) {}
}
public static class ParameterInfoExtensions {
public static EventInfo? GetDeclaringEvent(this ParameterInfo param) {}
public static PropertyInfo? GetDeclaringProperty(this ParameterInfo param) {}
public static bool IsReturnParameter(this ParameterInfo param) {}
}
public static class PropertyInfoExtensions {
public static FieldInfo? GetBackingField(this PropertyInfo property) {}
+ public static bool IsAccessorReadOnly(this PropertyInfo property) {}
public static bool IsOverride(this PropertyInfo property) {}
public static bool IsSetMethodInitOnly(this PropertyInfo property) {}
public static bool IsStatic(this PropertyInfo property) {}
}
public static class TypeExtensions {
public static MethodInfo? GetDelegateSignatureMethod(this Type t) {}
public static IEnumerable<Type> GetExplicitBaseTypeAndInterfaces(this Type t) {}
public static string GetGenericTypeName(this Type t) {}
public static IEnumerable<string> GetNamespaces(this Type t) {}
public static IEnumerable<string> GetNamespaces(this Type t, Func<Type, bool> isLanguagePrimitive) {}
public static bool IsByRefLikeValueType(this Type t) {}
public static bool IsConcreteDelegate(this Type t) {}
public static bool IsDelegate(this Type t) {}
public static bool IsEnumFlags(this Type t) {}
public static bool IsHidingInheritedType(this Type t, bool nonPublic) {}
public static bool IsReadOnlyValueType(this Type t) {}
public static bool IsStructLayoutDefault(this Type t) {}
}
}
namespace Smdn.Reflection.Attributes {
public static class CustomAttributeTypedArgumentExtensions {
public static object? GetTypedValue(this CustomAttributeTypedArgument typedArg) {}
}
public static class ICustomAttributeProviderExtensions {
public static IList<CustomAttributeData> GetCustomAttributeDataList(this ICustomAttributeProvider attributeProvider) {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.1.7.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.3.0.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
Full changes
Full changes in this release:
diff --git a/src/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection.csproj b/src/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection.csproj
index f8cbdd93..1ff802ef 100644
--- a/src/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection.csproj
+++ b/src/Smdn.Fundamental.Reflection/Smdn.Fundamental.Reflection.csproj
@@ -6,11 +6,14 @@ SPDX-License-Identifier: MIT
<PropertyGroup>
<TargetFrameworks>net6.0;net45;netstandard2.1;netstandard2.0</TargetFrameworks>
<RootNamespace>Smdn.Reflection</RootNamespace>
- <VersionPrefix>3.4.0</VersionPrefix>
+ <VersionPrefix>3.5.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<PackageValidationBaselineVersion>3.0.0</PackageValidationBaselineVersion>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <EnableTrimAnalyzer>false</EnableTrimAnalyzer>
+ <RootNamespace/> <!-- empty the root namespace so that the namespace is determined only by the directory name, for code style rule IDE0030 -->
+ <NoWarn>CS1591;$(NoWarn)</NoWarn> <!-- CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member' -->
</PropertyGroup>
<PropertyGroup Label="assembly attributes">
diff --git a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/EventInfoExtensions.cs b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/EventInfoExtensions.cs
index d8897169..a8626ba1 100644
--- a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/EventInfoExtensions.cs
+++ b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/EventInfoExtensions.cs
@@ -120,4 +121,9 @@ public static class EventInfoExtensions {
: ev.RemoveMethod is null
? ev.AddMethod.IsOverride()
: ev.AddMethod.IsOverride() && ev.RemoveMethod.IsOverride();
+
+ public static bool IsReadOnly(this EventInfo ev)
+ => ev is null
+ ? throw new ArgumentNullException(nameof(ev))
+ : (ev.AddMethod?.IsReadOnly() ?? ev.RemoveMethod?.IsReadOnly() ?? false);
}
diff --git a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MemberInfoExtensions.cs b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MemberInfoExtensions.cs
index e5b1f24a..6885cbd5 100644
--- a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MemberInfoExtensions.cs
+++ b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MemberInfoExtensions.cs
@@ -8,47 +8,48 @@ namespace Smdn.Reflection;
public static class MemberInfoExtensions {
public static Accessibility GetAccessibility(this MemberInfo member)
+ => member switch {
+ null => throw new ArgumentNullException(nameof(member)),
+ Type t => GetAccessibility(t),
+ FieldInfo f => GetAccessibility(f),
+ MethodBase m => GetAccessibility(m),
+ PropertyInfo p => throw new InvalidOperationException("cannot get accessibility of " + nameof(PropertyInfo)),
+ EventInfo ev => throw new InvalidOperationException("cannot get accessibility of " + nameof(EventInfo)),
+ _ => throw new NotSupportedException("unknown member type"),
+ };
+
+ private static Accessibility GetAccessibility(Type t)
{
- switch (member) {
- case null:
- throw new ArgumentNullException(nameof(member));
-
- case Type t:
if (t.IsPublic || t.IsNestedPublic) return Accessibility.Public;
if (t.IsNotPublic || t.IsNestedAssembly) return Accessibility.Assembly;
if (t.IsNestedFamily) return Accessibility.Family;
if (t.IsNestedFamORAssem) return Accessibility.FamilyOrAssembly;
if (t.IsNestedFamANDAssem) return Accessibility.FamilyAndAssembly;
if (t.IsNestedPrivate) return Accessibility.Private;
- break;
- case FieldInfo f:
+ return Accessibility.Undefined;
+ }
+
+ private static Accessibility GetAccessibility(FieldInfo f)
+ {
if (f.IsPublic) return Accessibility.Public;
if (f.IsAssembly) return Accessibility.Assembly;
if (f.IsFamily) return Accessibility.Family;
if (f.IsFamilyOrAssembly) return Accessibility.FamilyOrAssembly;
if (f.IsFamilyAndAssembly) return Accessibility.FamilyAndAssembly;
if (f.IsPrivate) return Accessibility.Private;
- break;
- case MethodBase m:
+ return Accessibility.Undefined;
+ }
+
+ private static Accessibility GetAccessibility(MethodBase m)
+ {
if (m.IsPublic) return Accessibility.Public;
if (m.IsAssembly) return Accessibility.Assembly;
if (m.IsFamily) return Accessibility.Family;
if (m.IsFamilyOrAssembly) return Accessibility.FamilyOrAssembly;
if (m.IsFamilyAndAssembly) return Accessibility.FamilyAndAssembly;
if (m.IsPrivate) return Accessibility.Private;
- break;
-
- case PropertyInfo p:
- throw new InvalidOperationException("cannot get accessibility of " + nameof(PropertyInfo));
-
- case EventInfo ev:
- throw new InvalidOperationException("cannot get accessibility of " + nameof(EventInfo));
-
- default:
- throw new NotSupportedException("unknown member type");
- }
return Accessibility.Undefined;
}
diff --git a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodBaseExtensions.cs b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodBaseExtensions.cs
index 4cfcfe42..5750b542 100644
--- a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodBaseExtensions.cs
+++ b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodBaseExtensions.cs
@@ -37,7 +37,7 @@ public static class MethodBaseExtensions {
bool findOnlyPublicInterfaces = false
)
=> TryFindExplicitInterfaceMethod(
- m,
+ m, // allow null
out explicitInterfaceMethod,
findOnlyPublicInterfaces,
throwException: false
@@ -56,7 +56,7 @@ public static class MethodBaseExtensions {
}
private static bool TryFindExplicitInterfaceMethod(
- MethodBase m,
+ MethodBase? m,
out MethodInfo? explicitInterfaceMethod,
bool findOnlyPublicInterfaces,
bool throwException
@@ -66,7 +66,8 @@ public static class MethodBaseExtensions {
if (m is not MethodInfo im)
return false;
- if (!(m.IsStatic || im.IsFinal)) // explicit interface method must be final or static (in case of static interface members)
+
+ if (!(im.IsStatic || im.IsFinal)) // explicit interface method must be final or static (in case of static interface members)
return false;
if (!im.IsPrivate) // explicit interface method must be private
return false;
@@ -103,7 +104,7 @@ public static class MethodBaseExtensions {
return false;
}
- private static readonly Dictionary<string, MethodSpecialName> specialMethodNames = new(StringComparer.Ordinal) {
+ private static readonly Dictionary<string, MethodSpecialName> SpecialMethodNames = new(StringComparer.Ordinal) {
// comparison
{ "op_Equality", MethodSpecialName.Equality },
{ "op_Inequality", MethodSpecialName.Inequality },
@@ -115,27 +116,36 @@ public static class MethodBaseExtensions {
// unary
{ "op_UnaryPlus", MethodSpecialName.UnaryPlus },
{ "op_UnaryNegation", MethodSpecialName.UnaryNegation },
+ { "op_CheckedUnaryNegation", MethodSpecialName.CheckedUnaryNegation },
{ "op_LogicalNot", MethodSpecialName.LogicalNot },
{ "op_OnesComplement", MethodSpecialName.OnesComplement },
{ "op_True", MethodSpecialName.True },
{ "op_False", MethodSpecialName.False },
{ "op_Increment", MethodSpecialName.Increment },
+ { "op_CheckedIncrement", MethodSpecialName.CheckedIncrement },
{ "op_Decrement", MethodSpecialName.Decrement },
+ { "op_CheckedDecrement", MethodSpecialName.CheckedDecrement },
// binary
{ "op_Addition", MethodSpecialName.Addition },
+ { "op_CheckedAddition", MethodSpecialName.CheckedAddition },
{ "op_Subtraction", MethodSpecialName.Subtraction },
+ { "op_CheckedSubtraction", MethodSpecialName.CheckedSubtraction },
{ "op_Multiply", MethodSpecialName.Multiply },
+ { "op_CheckedMultiply", MethodSpecialName.CheckedMultiply },
{ "op_Division", MethodSpecialName.Division },
+ { "op_CheckedDivision", MethodSpecialName.CheckedDivision },
{ "op_Modulus", MethodSpecialName.Modulus },
{ "op_BitwiseAnd", MethodSpecialName.BitwiseAnd },
{ "op_BitwiseOr", MethodSpecialName.BitwiseOr },
{ "op_ExclusiveOr", MethodSpecialName.ExclusiveOr },
{ "op_RightShift", MethodSpecialName.RightShift },
+ { "op_UnsignedRightShift", MethodSpecialName.UnsignedRightShift },
{ "op_LeftShift", MethodSpecialName.LeftShift },
// type cast
{ "op_Explicit", MethodSpecialName.Explicit },
+ { "op_CheckedExplicit", MethodSpecialName.CheckedExplicit },
{ "op_Implicit", MethodSpecialName.Implicit },
};
@@ -147,7 +157,7 @@ public static class MethodBaseExtensions {
if (!m.IsSpecialName)
return MethodSpecialName.None;
- if (specialMethodNames.TryGetValue(m.Name, out var methodSpecialName))
+ if (SpecialMethodNames.TryGetValue(m.Name, out var methodSpecialName))
return methodSpecialName;
if (m is ConstructorInfo)
diff --git a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodInfoExtensions.cs b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodInfoExtensions.cs
index 40249c57..fda4ec2b 100644
--- a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodInfoExtensions.cs
+++ b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodInfoExtensions.cs
@@ -185,4 +185,11 @@ public static class MethodInfoExtensions {
return true;
}
+
+ public static bool IsReadOnly(this MethodInfo m)
+ => m is null
+ ? throw new ArgumentNullException(nameof(m))
+ : m.GetCustomAttributesData().Any(
+ static d => string.Equals(d.AttributeType.FullName, "System.Runtime.CompilerServices.IsReadOnlyAttribute", StringComparison.Ordinal)
+ );
}
diff --git a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodSpecialName.cs b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodSpecialName.cs
index 61f75418..bc74df69 100644
--- a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodSpecialName.cs
+++ b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodSpecialName.cs
@@ -43,4 +43,17 @@ public enum MethodSpecialName {
// type cast
Explicit,
Implicit,
+
+ // unsigned right shift (C#11)
+ UnsignedRightShift,
+
+ // checked (C#11)
+ CheckedUnaryNegation,
+ CheckedIncrement,
+ CheckedDecrement,
+ CheckedAddition,
+ CheckedSubtraction,
+ CheckedMultiply,
+ CheckedDivision,
+ CheckedExplicit,
}
diff --git a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/ParameterInfoExtensions.cs b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/ParameterInfoExtensions.cs
index e92b73ae..722a6f82 100644
--- a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/ParameterInfoExtensions.cs
+++ b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/ParameterInfoExtensions.cs
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: MIT
using System;
using System.Reflection;
-using System.Runtime.CompilerServices;
namespace Smdn.Reflection;
@@ -19,10 +18,6 @@ public static class ParameterInfoExtensions {
#endif
}
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- private static BindingFlags GetBindingFlagsForAccessorOwner(MethodInfo accessor)
- => (accessor.IsStatic ? BindingFlags.Static : BindingFlags.Instance) | BindingFlags.Public | BindingFlags.NonPublic;
-
public static PropertyInfo? GetDeclaringProperty(this ParameterInfo param)
{
if (param is null)
@@ -32,7 +27,7 @@ public static class ParameterInfoExtensions {
var isReturnParameter = IsReturnParameter(param);
- MethodInfoExtensions.TryGetPropertyFromAccessorMethod(
+ _ = MethodInfoExtensions.TryGetPropertyFromAccessorMethod(
accessor: accessor,
expectGet: isReturnParameter,
expectSet: !isReturnParameter,
@@ -53,7 +48,7 @@ public static class ParameterInfoExtensions {
if (!string.Equals("value", param.Name, StringComparison.Ordinal)) // parameter name of event accessor method must be `value`
return null;
- MethodInfoExtensions.TryGetEventFromAccessorMethod(
+ _ = MethodInfoExtensions.TryGetEventFromAccessorMethod(
accessor: accessor,
expectAdd: true,
expectRemove: true,
diff --git a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/PropertyInfoExtensions.cs b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/PropertyInfoExtensions.cs
index 1ce8d199..a65a26ef 100644
--- a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/PropertyInfoExtensions.cs
+++ b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/PropertyInfoExtensions.cs
@@ -102,4 +103,9 @@ public static class PropertyInfoExtensions {
: property.SetMethod is null
? property.GetMethod.IsOverride()
: property.GetMethod.IsOverride() && property.SetMethod.IsOverride();
+
+ public static bool IsAccessorReadOnly(this PropertyInfo property)
+ => property is null
+ ? throw new ArgumentNullException(nameof(property))
+ : property.GetMethod?.IsReadOnly() ?? false;
}
diff --git a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/TypeExtensions.cs b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/TypeExtensions.cs
index b23dcd25..e3e65896 100644
--- a/src/Smdn.Fundamental.Reflection/Smdn.Reflection/TypeExtensions.cs
+++ b/src/Smdn.Fundamental.Reflection/Smdn.Reflection/TypeExtensions.cs
@@ -238,14 +238,14 @@ public static class TypeExtensions {
internal static IEnumerable<Type> EnumerateTypeHierarchy(Type t, bool includeSelf)
{
- Type? _t = t;
+ Type? ty = t;
if (includeSelf)
- yield return _t;
+ yield return ty;
for (; ; ) {
- if ((_t = _t?.BaseType) is not null)
- yield return _t;
+ if ((ty = ty?.BaseType) is not null)
+ yield return ty;
else
break;
}
Notes
Full Changelog: releases/Smdn.Fundamental.Reflection-3.4.0...releases/Smdn.Fundamental.Reflection-3.5.0