/// <summary> /// Initializes a new instance of the <see cref="OpenGraphTag"/> class. /// </summary> /// <param name="key">The key.</param> /// <param name="value">The value.</param> /// <exception cref="System.ArgumentNullException">key</exception> public OpenGraphTag(OpenGraphName key, string value) { if (key == null) { throw new ArgumentNullException("key"); } this.key = key; this.value = value; }
internal OpenGraphObject SetTag(OpenGraphName name, string value) { var tags = this.Tags.Where(t => t.Key == name).ToArray(); if (tags.Length == 0) { this.Tags.Add(new OpenGraphTag(name, value)); } else if (tags.Length == 1) { tags[0].Value = value; } else { this.tags.RemoveAll(t => t.Key == name); this.Tags.Add(new OpenGraphTag(name, value)); } return(this); }