/// <summary> /// This method should be used only by SnippetSP to load the tags into the object and safely store it into the cache /// </summary> /// <param name="addingTag"></param> protected void AddTagToCollection(Tag addingTag) { //if the tag is not yet present in the list, add it: if (m_tags == null) m_tags = new List<Tag>(); else { foreach (Tag tag in m_tags) { if (tag == null) continue; if ((addingTag == null) || tag.Value.Equals(addingTag.Value, StringComparison.InvariantCultureIgnoreCase)) return; } } m_tags.Add(addingTag); }
/// <summary> /// This is the init/copy method for this class. /// It should be used by the children classes in the constructor in order to correctly fill the properties of the object. /// </summary> /// <param name="objToCopy"></param> protected bool Init(Tag objToCopy) { if (objToCopy == null) return false; Init(objToCopy.ID, objToCopy.Value); return true; }
///////////////////////////////////////////////////////////////////////////////////////////////////// #region Public Methods ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Adds the given content to the list of tags, if not yet present. /// This procedure modifies only the local in-memory content of the snippet. /// </summary> /// <param name="addingTag"></param> public void AddTag(Tag addingTag) { m_tags = Tags; AddTagToCollection(addingTag); }