internal static object GetNodeData(Node node, Type type) { System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(type.TypeHandle); try { if (type == typeof(string) && node.Value == MultiLineStringNode.Terminator && node.ChildLines.Count > 0) { return(BaseTypes.ParseSpecialStringCase(node)); } if (BaseTypes.IsBaseType(type)) { return(BaseTypes.ParseBaseType(node.Value, type)); } var collection = CollectionTypes.TryGetCollection(node, type); if (collection != null) { return(collection); } if (!String.IsNullOrEmpty(node.Value)) { return(ComplexTypeShortcuts.GetFromShortcut(node.Value, type)); } return(ComplexTypes.RetrieveComplexType(node, type)); } catch (Exception e) { throw new Exception($"Error getting data of type {type} from node: {e.InnerException}"); } }