@@ -39,14 +39,18 @@ public static class EntitlementKeys
39
39
public const string Siri = "com.apple.developer.siri" ;
40
40
public const string APS = "aps-environment" ;
41
41
42
- public static IEnumerable < string > AllKeys {
43
- get {
44
- var entitlementKeys = typeof ( EntitlementKeys ) . GetFields ( BindingFlags . Public | BindingFlags . Static ) .
45
- Where ( f => f . FieldType == typeof ( string ) ) .
46
- Select ( field => ( string ) field . GetValue ( null ) ) .
47
- ToList ( ) ;
42
+ static string [ ] allKeys ;
48
43
49
- return entitlementKeys ;
44
+ public static string [ ] AllKeys {
45
+ get {
46
+ if ( allKeys == null ) {
47
+ allKeys = typeof ( EntitlementKeys ) . GetFields ( BindingFlags . Public | BindingFlags . Static ) .
48
+ Where ( f => f . FieldType == typeof ( string ) ) .
49
+ Select ( field => ( string ) field . GetValue ( null ) ) .
50
+ ToArray ( ) ;
51
+ }
52
+
53
+ return allKeys ;
50
54
}
51
55
}
52
56
}
@@ -158,13 +162,14 @@ public static void SetPassBookIdentifiers (this PDictionary dict, PArray value)
158
162
dict [ EntitlementKeys . PassBookIdentifiers ] = value ;
159
163
}
160
164
161
- public static IEnumerable < string > GetEntitlementKeys ( this PDictionary dict )
165
+ public static List < string > GetEntitlementKeys ( this PDictionary dict )
162
166
{
163
167
var enabledEntitlements = new List < string > ( ) ;
168
+ var keys = EntitlementKeys . AllKeys ;
164
169
165
- foreach ( var key in EntitlementKeys . AllKeys ) {
166
- if ( dict . ContainsKey ( key ) )
167
- enabledEntitlements . Add ( key ) ;
170
+ for ( int i = 0 ; i < keys . Length ; i ++ ) {
171
+ if ( dict . ContainsKey ( keys [ i ] ) )
172
+ enabledEntitlements . Add ( keys [ i ] ) ;
168
173
}
169
174
170
175
return enabledEntitlements ;
0 commit comments