Example #1
0
 private static void InitFromCache(CacheInitializer cache)
 {
     foreach (var cacheItem in cache.CustructCache())
     {
         RepresentationCache.Add(cacheItem);
     }
 }
Example #2
0
        /// <summary>
        /// Initializes the <see cref="EnumCore"/> with the enums provided by the <paramref name="initializer"/>.
        /// </summary>
        /// <param name="initializer">Provides a <see cref="CacheInitializer"/> instance where assemblies with enums can be added.</param>
        /// <param name="includeCallingAssembly">Indicates whether the calling assembly should be searched for enums or not.</param>
        public static void Init(Action <CacheInitializer> initializer, bool includeCallingAssembly = true)
        {
            var cacheInit = new CacheInitializer();

            if (includeCallingAssembly)
            {
                cacheInit.InitWith(Assembly.GetCallingAssembly());
            }

            initializer?.Invoke(cacheInit);

            InitFromCache(cacheInit);
        }