private static T[] GetArray <T>(ConfigElement element, string itemName, T[] _, Func <ConfigElement, T, T> convert) { var listNode = element.GetElement(itemName); if (listNode != null) { return(GetArray <T>(listNode, _, convert)); } return(null); }
private static T[] GetArray <T>(ConfigElement element, string itemName, T[] _, Func <ConfigElement, T, T> convert) { var listNode = element.GetElement(itemName); if (listNode != null) { string childName = itemName.Remove(itemName.Length - 1); List <T> list = new List <T>(); foreach (var node in listNode.GetElements(childName)) { list.Add(convert(node, default(T))); } return(list.Count > 0 ? list.ToArray() : null); } return(null); }
public static T Get <T>(ConfigElement element, string name, T _) where T : IGeneratorObject, new() { var node = element.GetElement(name); return(Convert(node, _)); }