Parser.ParserBase.GetTagFromType C# (CSharp) Method

GetTagFromType() protected method

Retrurns the tag instance from its type and value.
protected GetTagFromType ( string type, string value, bool hasContents ) : TagBase
type string
value string
hasContents bool
return TagBase
        protected TagBase GetTagFromType(string type, string value, bool hasContents)
        {
            foreach (Type myTagType in Tags)
            {
                string myType = TagBase.GetTagType(myTagType);
                if (string.Compare(myType, type, true) == 0)
                {
                    TagBase myTag = Activator.CreateInstance(myTagType) as TagBase;
                    myTag.InitializeFromData(this, value, hasContents);
                    return myTag;
                }
            }

            throw new Exception(string.Format("Tag cannot be found: {0}", type));
        }