theraot/Theraot

TypeExtensions properties

NN--- opened this issue · 0 comments

NN--- commented

Since C# doesn't support extension properties it is possible to introduce extension methods working for all frameworks like it is done in: https://github.com/rsdn/CodeJam/blob/master/CodeJam.Main/Targeting/TypeExtensions.cs

Example for IsSealed

		[MethodImpl(AggressiveInlining)]
		public static bool GetIsSealed([NotNull] this Type type) =>
#if TARGETS_NET || NETSTANDARD20_OR_GREATER || NETCOREAPP20_OR_GREATER
			type.IsSealed;
#else
			type.GetTypeInfo().IsSealed;
#endif

Another option is to make a class wrapper.