maui-linux/Xamarin.Forms.Build.Tasks/PropertyDefinitionExtension...

21 строка
638 B
C#
Исходник Обычный вид История

using System;
2016-03-22 23:02:25 +03:00
using Mono.Cecil;
namespace Xamarin.Forms.Build.Tasks
{
static class PropertyDefinitionExtensions
{
public static TypeReference ResolveGenericPropertyType(this PropertyDefinition self, TypeReference declaringTypeRef,
ModuleDefinition module)
2016-03-22 23:02:25 +03:00
{
if (self == null)
throw new ArgumentNullException(nameof(self));
if (declaringTypeRef == null)
throw new ArgumentNullException(nameof(declaringTypeRef));
if (!self.PropertyType.IsGenericParameter)
return self.PropertyType;
return ((GenericInstanceType)declaringTypeRef).GenericArguments [((GenericParameter)self.PropertyType).Position];
2016-03-22 23:02:25 +03:00
}
}
}