From 447cb033991c73da1ef8ada85433dd0b52c02fa5 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sun, 27 Oct 2019 05:31:10 -0700 Subject: [PATCH] Delete unnecessary abstraction from stubbed out SecurityElement (#27474) The stubbed out SecurityElement implementation does not support extensibility that ISecurityElementFactory was designed for. Signed-off-by: dotnet-bot --- .../shared/System/Security/SecurityElement.cs | 53 +--------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/netcore/System.Private.CoreLib/shared/System/Security/SecurityElement.cs b/netcore/System.Private.CoreLib/shared/System/Security/SecurityElement.cs index a15560b83ff..541f22dccdc 100644 --- a/netcore/System.Private.CoreLib/shared/System/Security/SecurityElement.cs +++ b/netcore/System.Private.CoreLib/shared/System/Security/SecurityElement.cs @@ -8,18 +8,7 @@ using System.Text; namespace System.Security { - internal interface ISecurityElementFactory - { - SecurityElement CreateSecurityElement(); - - object Copy(); - - string GetTag(); - - string? Attribute(string attributeName); - } - - public sealed class SecurityElement : ISecurityElementFactory + public sealed class SecurityElement { internal string _tag = null!; internal string? _text; @@ -171,7 +160,6 @@ namespace System.Security { get { - ConvertSecurityElementFactories(); return _children; } @@ -185,18 +173,6 @@ namespace System.Security } } - internal void ConvertSecurityElementFactories() - { - if (_children == null) - return; - - for (int i = 0; i < _children.Count; ++i) - { - if (_children[i] is ISecurityElementFactory iseFactory && !(_children[i] is SecurityElement)) - _children[i] = iseFactory.CreateSecurityElement(); - } - } - //-------------------------- Public Methods ----------------------------- internal void AddAttributeSafe(string name, string value) @@ -302,9 +278,6 @@ namespace System.Security if (_children.Count != other._children.Count) return false; - ConvertSecurityElementFactories(); - other.ConvertSecurityElementFactories(); - IEnumerator lhs = _children.GetEnumerator(); IEnumerator rhs = other._children.GetEnumerator(); @@ -532,8 +505,6 @@ namespace System.Security // Output any children. if (_children != null) { - ConvertSecurityElementFactories(); - write(obj, Environment.NewLineConst); for (int i = 0; i < _children.Count; ++i) @@ -631,27 +602,5 @@ namespace System.Security return default; } - - //--------------- ISecurityElementFactory implementation ----------------- - - SecurityElement ISecurityElementFactory.CreateSecurityElement() - { - return this; - } - - string ISecurityElementFactory.GetTag() - { - return ((SecurityElement)this).Tag; - } - - object ISecurityElementFactory.Copy() - { - return ((SecurityElement)this).Copy(); - } - - string? ISecurityElementFactory.Attribute(string attributeName) - { - return ((SecurityElement)this).Attribute(attributeName); - } } } -- 2.11.4.GIT