Skip to content

Commit ac2142f

Browse files
committed
Update the GetCustomAttributes calls to use existing extension methods.
1 parent d266179 commit ac2142f

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

Assets/MixedRealityToolkit/Attributes/MixedRealityControllerAttribute.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,7 @@ public MixedRealityControllerAttribute(
6363
/// </summary>
6464
public static MixedRealityControllerAttribute Find(Type type)
6565
{
66-
#if WINDOWS_UWP && !ENABLE_IL2CPP
67-
// Type.GetCustomAttributes() doesn't exist on UWP .NET, so we have to indirectly use
68-
// the TypeInfo instead.
69-
return type.GetTypeInfo().GetCustomAttributes(typeof(MixedRealityControllerAttribute), true).FirstOrDefault() as MixedRealityControllerAttribute;
70-
#else
7166
return type.GetCustomAttributes(typeof(MixedRealityControllerAttribute), true).FirstOrDefault() as MixedRealityControllerAttribute;
72-
#endif
7367
}
7468
}
7569
}

Assets/MixedRealityToolkit/Attributes/MixedRealityExtensionServiceAttribute.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
using UnityEditor;
1414
#endif
1515

16+
#if WINDOWS_UWP && !ENABLE_IL2CPP
17+
using Microsoft.MixedReality.Toolkit.Core.Extensions;
18+
#endif // WINDOWS_UWP && !ENABLE_IL2CPP
19+
1620
namespace Microsoft.MixedReality.Toolkit.Core.Attributes
1721
{
1822
/// <summary>
@@ -77,13 +81,7 @@ public MixedRealityExtensionServiceAttribute(
7781
/// </summary>
7882
public static MixedRealityExtensionServiceAttribute Find(Type type)
7983
{
80-
#if WINDOWS_UWP && !ENABLE_IL2CPP
81-
// Type.GetCustomAttributes() doesn't exist on UWP .NET, so we have to indirectly use
82-
// the TypeInfo instead.
83-
return type.GetTypeInfo().GetCustomAttributes(typeof(MixedRealityExtensionServiceAttribute), true).FirstOrDefault() as MixedRealityExtensionServiceAttribute;
84-
#else
8584
return type.GetCustomAttributes(typeof(MixedRealityExtensionServiceAttribute), true).FirstOrDefault() as MixedRealityExtensionServiceAttribute;
86-
#endif
8785
}
8886
}
8987
}

0 commit comments

Comments
 (0)