/// <summary> /// Sets the value of the artefact with the specified name /// </summary> /// <param name="name"></param> /// <param name="value"></param> public void SetArtefact(string name, object value) { LinkedNameValue current = _artefacts; while (null != current) { //If we alread have one with the same name, just set the value if (_comparer.Compare(current.Name, name) == COMPARE_EQUAL) { current.Value = value; return; } current = current.Next; } //Not found so - create a new one and put it at the front of the list current = new LinkedNameValue() { Name = name, Value = value, Next = _artefacts }; _artefacts = current; }
// // methods // #region public bool TryGetArtefact(string name, out object value) /// <summary> /// Attempts to retrieve an artefact with the specified name. /// Returns true if one was found otherwise false. /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <returns></returns> public bool TryGetArtefact(string name, out object value) { LinkedNameValue current = _artefacts; while (null != current) { if (_comparer.Compare(current.Name, name) == COMPARE_EQUAL) { value = current.Value; return(true); } current = current.Next; } value = null; return(false); }
/// <summary> /// Clears all registered artefacts from the set /// </summary> public void ClearArtefacts() { _artefacts = null; }