Better Contains() for merging elements with same/different ID

This commit is contained in:
Michael Becker 2014-06-25 09:04:00 -04:00
parent f458c1672a
commit e43be5d503

View File

@ -69,9 +69,17 @@ namespace UniversalEditor.ObjectModels.Markup
item.mvarParent = this._parent;
base.Add(item);
}
public bool Contains(string fullName)
public bool Contains(string fullName, string id = null)
{
return this[fullName] != null;
MarkupElement el = this[fullName];
MarkupTagElement tag = (el as MarkupTagElement);
bool retval = el != null;
if (id != null && tag != null)
{
MarkupAttribute attID = tag.Attributes["ID"];
if (attID != null) retval &= (id == attID.Value);
}
return retval;
}
public bool Contains(string fullName, Type elementType)
{