/// <summary> /// Attempt to create a collection of the picked (key/label) items from the saved string value /// NOTE: the CSV format, or relations only will not work, as the data isn't in the saved value (will return false) /// </summary> /// <param name="value">the saved value as a string</param> /// <param name="editorDataItems"></param> /// <returns>bool flag to indicate whether the items could be created from the savedValue supplied</returns> internal static bool TryGetDataEditorItems(string value, out IEnumerable <EditorDataItem> editorDataItems) { editorDataItems = SaveFormat.GetKeyValuePairs(value) .Where(x => x.Value != null) .Select(x => new EditorDataItem() { Key = x.Key, Label = x.Value }); return(editorDataItems.Count() > 0); }
/// <summary> /// Ignore the specified saved format, and try and restore collection directly from the supplied string value /// </summary> /// <param name="value">the value as a string</param> /// <returns></returns> internal static IEnumerable <string> GetKeys(string value) { return(SaveFormat.GetKeyValuePairs(value).Select(x => x.Key)); }