newtelligence.DasBlog.Web.Core.ValidTag.ValidTag C# (CSharp) Method

ValidTag() public method

Initializes a new instance of the ValidTag class.
public ValidTag ( string tagDefinition ) : System
tagDefinition string The tag definition, defined as 'tag@att1@att2'.
return System
        public ValidTag(string tagDefinition)
        {
            if(tagDefinition == null || tagDefinition.Length == 0 ){
                throw new ArgumentNullException( "tagDefinition" );
            }

            // tags are defined as tag@att1@att2
            // so splitting on @ should give us what we need
            string[] splitDef = tagDefinition.Split('@');

            // first item is the name
            this.name = splitDef[0];

            // check for attributes and copy to collection
            if( splitDef.Length == 1 ){
                attributes= new string[0];
            }else{
                attributes = new string[ splitDef.Length - 1 ];
                Array.Copy( splitDef, 1, attributes, 0, attributes.Length );
                Array.Sort( attributes, new CaseInsensitiveComparer( CultureInfo.InvariantCulture ));
            }
        }

Same methods

ValidTag::ValidTag ( ) : System