System.Security.SecurityElement.SearchForTextOfTag C# (CSharp) Method

SearchForTextOfTag() public method

public SearchForTextOfTag ( string tag ) : string
tag string
return string
        public string SearchForTextOfTag(string tag)
        {
            // Search on each child in order and each
            // child's child, depth-first
            if (tag == null)
                throw new ArgumentNullException(nameof(tag));

            // Note: we don't check for a valid tag here because
            // an invalid tag simply won't be found.    
            if (string.Equals(_tag, tag))
                return Unescape(_text);
            if (_children == null)
                return null;

            foreach (SecurityElement child in Children)
            {
                string text = child.SearchForTextOfTag(tag);
                if (text != null)
                    return text;
            }
            return null;
        }

Usage Example

 public SignatureDescription(SecurityElement el)
 {
     if (el == null)
     {
         throw new ArgumentNullException("el");
     }
     this._strKey = el.SearchForTextOfTag("Key");
     this._strDigest = el.SearchForTextOfTag("Digest");
     this._strFormatter = el.SearchForTextOfTag("Formatter");
     this._strDeformatter = el.SearchForTextOfTag("Deformatter");
 }