private object ParseValue(string s) { if (string.IsNullOrEmpty(s)) { return(null); } if (s.StartsWith('\"') && s.EndsWith('\"')) { return(s.Substring(1, s.Length - 2)); } if (s.StartsWith('[') && s.EndsWith(']')) { var array = _context.ParseBufferToArray(s, "CsvImport/ArrayValue", BlittableJsonDocumentBuilder.UsageMode.None); _disposables.Add(array); return(array); } if (char.IsDigit(s[0]) || s[0] == '-') { if (s.IndexOf('.') > 0) { if (decimal.TryParse(s, NumberStyles.Number, CultureInfo.InvariantCulture, out var dec)) { return(dec); } } else { if (long.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var l)) { return(l); } } } if ((s.Length == 4 && s[0] == 't' || s.Length == 5 && s[0] == 'f') && bool.TryParse(s, out var b)) { return(b); } if (s.Length == 4 && s.Equals("null")) { return(null); } return(s); }