/// <summary> /// Instantiates a new instance of a <see cref="TagHelperBlock"/>. /// </summary> /// <param name="source">A <see cref="TagHelperBlockBuilder"/> used to construct a valid /// <see cref="TagHelperBlock"/>.</param> public TagHelperBlock(TagHelperBlockBuilder source) : base(source.Type, source.Children, source.CodeGenerator) { TagName = source.TagName; Attributes = new Dictionary <string, SyntaxTreeNode>(source.Attributes); _start = source.Start; source.Reset(); foreach (var attributeChildren in Attributes.Values) { attributeChildren.Parent = this; } }
/// <summary> /// Instantiates a new instance of a <see cref="TagHelperBlock"/>. /// </summary> /// <param name="source">A <see cref="TagHelperBlockBuilder"/> used to construct a valid /// <see cref="TagHelperBlock"/>.</param> public TagHelperBlock(TagHelperBlockBuilder source) : base(source.Type, source.Children, source.ChunkGenerator) { TagName = source.TagName; Descriptors = source.Descriptors; Attributes = new List <KeyValuePair <string, SyntaxTreeNode> >(source.Attributes); _start = source.Start; SelfClosing = source.SelfClosing; SourceStartTag = source.SourceStartTag; SourceEndTag = source.SourceEndTag; source.Reset(); foreach (var attributeChildren in Attributes) { if (attributeChildren.Value != null) { attributeChildren.Value.Parent = this; } } }