Ejemplo n.º 1
0
        /// <summary>
        /// Creates an instance of the builder from the given builder.
        /// </summary>
        /// <param name="builder">The builder to start the new instance from.</param>
        public ComponentBuilder(IComponentBuilder builder)
        {
            var sourceAttributes = builder?.BuildAttributes();
            var sourceStyles     = builder?.BuildStyles();

            foreach (var key in sourceAttributes?.Keys ?? new string[0])
            {
                this.Attributes[key] = sourceAttributes[key];
            }

            foreach (var key in sourceStyles?.Keys ?? new string[0])
            {
                this.Styles[key] = sourceStyles[key];
            }

            this.AddClasses((from x in builder?.BuildClasses() ?? new string[0] select x).ToArray());
        }