diff --git a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttribute.cs b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttribute.cs
index 96954d9346..f9fada7a01 100644
--- a/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttribute.cs
+++ b/src/Microsoft.AspNet.Razor.Runtime/TagHelpers/TagHelperAttribute.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using Microsoft.Framework.Internal;
namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
@@ -19,6 +20,17 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
{
}
+ ///
+ /// Instantiates a new instance of with values provided by the given
+ /// .
+ ///
+ /// A whose values should be copied.
+ public TagHelperAttribute([NotNull] IReadOnlyTagHelperAttribute attribute)
+ : this (attribute?.Name, attribute?.Value)
+ {
+ Minimized = attribute.Minimized;
+ }
+
///
/// Instantiates a new instance of with the specified
/// and .
diff --git a/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeTest.cs b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeTest.cs
new file mode 100644
index 0000000000..c7e469b6fb
--- /dev/null
+++ b/test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperAttributeTest.cs
@@ -0,0 +1,36 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Xunit;
+
+namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
+{
+ public class TagHelperAttributeTest
+ {
+ public static TheoryData CopyConstructorData
+ {
+ get
+ {
+ return new TheoryData
+ {
+ new TagHelperAttribute("hello", "world") { Minimized = false },
+ new TagHelperAttribute("checked", value: null) { Minimized = true },
+ };
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(CopyConstructorData))]
+ public void CopyConstructorCopiesValuesAsExpected(IReadOnlyTagHelperAttribute readOnlyTagHelperAttribute)
+ {
+ // Act
+ var tagHelperAttribute = new TagHelperAttribute(readOnlyTagHelperAttribute);
+
+ // Assert
+ Assert.Equal(
+ readOnlyTagHelperAttribute,
+ tagHelperAttribute,
+ CaseSensitiveTagHelperAttributeComparer.Default);
+ }
+ }
+}