public void addPhoto(Photo p) { if (Photos.Count < pLimit) { Photos.Add(p); if (Description == null) { Description = p.Description; } } }
public Product(Photo p) { addPhoto(p); }
private void extrachPhotos(string content) { String pattern = "\"media\":{\"content\":\\[{\"url\":\"([^\"]+)\".*?\\],\"description\":\"([^\"]*)\""; MatchCollection matches = Regex.Matches(content, pattern, RegexOptions.IgnoreCase); for (int i = 0; i < matches.Count; i++) { Photo p = new Photo(matches[i].Groups[1].Value, matches[i].Groups[2].Value); photos.Add(p); } }