get customAttribute for netfx

This commit is contained in:
Martin Scholz
2016-06-21 19:40:16 +02:00
parent ac14c5e1a2
commit c1a16ffc74
+4 -1
View File
@@ -80,11 +80,14 @@ namespace Octokit.Internal
{
var type = p.GetType();
var name = Enum.GetName(type, p);
#if NETFX_CORE
var attr = type.GetTypeInfo().GetCustomAttribute<ParameterAttribute>();
#else
var attr = type.GetField(name)
.GetCustomAttributes(false)
.OfType<ParameterAttribute>()
.SingleOrDefault();
#endif
if (attr != null)
return attr.Value;