bool ICollection <KeyValuePair <string, string> > .Remove(KeyValuePair <string, string> item) { //if (ContainsKey(item.Key) // && Attributes[DomData.TokenID(item.Key,true)] == item.Value) //{ // return Remove(item.Key); //} //else //{ // return false; //} int index = InnerKeys.IndexOf(DomData.TokenID(item.Key, true)); if (index < 0) { return(false); } else { if (InnerValues[index] == item.Value) { return(Remove(item.Key)); } else { return(false); } } }
public bool Unset(ushort tokenId) { //return Attributes.Remove(tokenId); int index = InnerKeys.IndexOf(tokenId); if (index >= 0) { InnerKeys.RemoveAt(index); InnerValues.RemoveAt(index); return(true); } return(false); }
bool ICollection <KeyValuePair <string, string> > .Contains(KeyValuePair <string, string> item) { //return ContainsKey(item.Key) //&& Attributes[DomData.TokenID(item.Key,true)] == item.Value; int index = InnerKeys.IndexOf(DomData.TokenID(item.Key, true)); if (index < 0) { return(false); } else { return(InnerValues[index] == item.Value); } }
public void SetBoolean(ushort tokenId) { //Attributes[tokenId] = null; int index = InnerKeys.IndexOf(tokenId); if (index < 0) { index = InnerKeys.Count; InnerKeys.Add(tokenId); InnerValues.Add(null); } else { InnerValues[index] = null; } }
protected string Get(ushort tokenId) { //string value; // if (Attributes.TryGetValue(tokenId, out value)) //if (Attributes.TryGetValue(tokenId, out value)) //{ // return value; //} //else //{ // return null; //} int index = InnerKeys.IndexOf(tokenId); return(index < 0 ? null : InnerValues[index]); }
/// <summary> /// Used by DomElement to (finally) set the ID value /// </summary> /// <param name="tokenId"></param> /// <param name="value"></param> internal void SetRaw(ushort tokenId, string value) { if (value == null) { Unset(tokenId); } else { //Attributes[tokenId] = value; int index = InnerKeys.IndexOf(tokenId); if (index < 0) { index = InnerKeys.Count; InnerKeys.Add(tokenId); InnerValues.Add(value); } else { InnerValues[index] = value; } } }