| 123456789101112131415161718192021 |
- using System;
- using System.Reflection;
- namespace Quadarax.Foundation.Core.Reflection.Extensions
- {
- public static class PropertyInfoExt
- {
- public static Type GetFinalPropertyType(this PropertyInfo owner)
- {
- if (owner == null) throw new ArgumentNullException(nameof(owner));
- var propertyType = owner.PropertyType;
- if (propertyType.IsGenericType &&
- propertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
- {
- propertyType = propertyType.GetGenericArguments()[0];
- }
- return propertyType;
- }
- }
- }
|