public PostfixTemplatesManager([NotNull] IEnumerable<IPostfixTemplateProvider> providers)
        {
            var infos = new List<TemplateProviderInfo>();
              foreach (var provider in providers)
              {
            var providerType = provider.GetType();
            var attributes = (PostfixTemplateProviderAttribute[])
              providerType.GetCustomAttributes(typeof (PostfixTemplateProviderAttribute), false);
            if (attributes.Length == 1)
            {
              var info = new TemplateProviderInfo(provider, providerType.FullName, attributes[0]);
              infos.Add(info);
            }
              }

              myTemplateProvidersInfos = infos.AsReadOnly();
        }
Ejemplo n.º 2
0
        public PostfixTemplatesManager([NotNull] IEnumerable <IPostfixTemplate> providers)
        {
            var infos = new List <TemplateProviderInfo>();

            foreach (var provider in providers)
            {
                var providerType = provider.GetType();
                var attributes   = (PostfixTemplateAttribute[])
                                   providerType.GetCustomAttributes(typeof(PostfixTemplateAttribute), inherit: false);

                if (attributes.Length == 1)
                {
                    var info = new TemplateProviderInfo(provider, attributes[0], providerType.FullName);
                    infos.Add(info);
                }
            }

            myTemplateProvidersInfos = infos.AsReadOnly();
        }