public IEnumerable <ushort> AddEvents(XElement element) { for (var i = 0; i < 4; i++) { var type = (BlockEventType)i; var attr = element.GetAttributeValue(type.ToString() + 's'); if (attr == null) { continue; } foreach (var e in attr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(str => BlockEvent.Parse(Parent, type, str))) { yield return((ushort)BlockEvents.Count); BlockEvents.Add(e); } } }