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

IsValidTag() public static method

public static IsValidTag ( string tag ) : bool
tag string
return bool
        public static bool IsValidTag(string tag)
        {
            if (tag == null)
                return false;

            return tag.IndexOfAny(s_tagIllegalCharacters) == -1;
        }

Usage Example

 /// <summary>Initializes a new instance of the <see cref="T:System.Security.SecurityElement" /> class with the specified tag and text.</summary>
 /// <param name="tag">The tag name of the XML element. </param>
 /// <param name="text">The text content within the element. </param>
 /// <exception cref="T:System.ArgumentNullException">The <paramref name="tag" /> parameter is null. </exception>
 /// <exception cref="T:System.ArgumentException">The <paramref name="tag" /> parameter or <paramref name="text" /> parameter is invalid in XML. </exception>
 public SecurityElement(string tag, string text)
 {
     if (tag == null)
     {
         throw new ArgumentNullException("tag");
     }
     if (!SecurityElement.IsValidTag(tag))
     {
         throw new ArgumentException(Locale.GetText("Invalid XML string") + ": " + tag);
     }
     this.tag  = tag;
     this.Text = text;
 }
All Usage Examples Of System.Security.SecurityElement::IsValidTag