Newtonsoft.Json.JsonReaderException.Create C# (CSharp) Method

Create() static private method

static private Create ( IJsonLineInfo lineInfo, string path, string message, Exception ex ) : JsonReaderException
lineInfo IJsonLineInfo
path string
message string
ex System.Exception
return JsonReaderException
        internal static JsonReaderException Create(IJsonLineInfo lineInfo, string path, string message, Exception ex)
        {
            message = JsonPosition.FormatMessage(lineInfo, path, message);

            int lineNumber;
            int linePosition;
            if (lineInfo != null && lineInfo.HasLineInfo())
            {
                lineNumber = lineInfo.LineNumber;
                linePosition = lineInfo.LinePosition;
            }
            else
            {
                lineNumber = 0;
                linePosition = 0;
            }

            return new JsonReaderException(message, ex, path, lineNumber, linePosition);
        }
    }

Same methods

JsonReaderException::Create ( JsonReader reader, string message ) : JsonReaderException
JsonReaderException::Create ( JsonReader reader, string message, Exception ex ) : JsonReaderException

Usage Example

示例#1
0
        // Token: 0x06000C0A RID: 3082 RVA: 0x0004F940 File Offset: 0x0004DB40
        internal decimal?ReadDecimalString(string s)
        {
            if (StringUtils.IsNullOrEmpty(s))
            {
                this.SetToken(JsonToken.Null, null, false);
                return(null);
            }
            decimal num;

            if (decimal.TryParse(s, NumberStyles.Number, this.Culture, out num))
            {
                this.SetToken(JsonToken.Float, num, false);
                return(new decimal?(num));
            }
            if (ConvertUtils.DecimalTryParse(s.ToCharArray(), 0, s.Length, out num) == ParseResult.Success)
            {
                this.SetToken(JsonToken.Float, num, false);
                return(new decimal?(num));
            }
            this.SetToken(JsonToken.String, s, false);
            throw JsonReaderException.Create(this, "Could not convert string to decimal: {0}.".FormatWith(CultureInfo.InvariantCulture, s));
        }
All Usage Examples Of Newtonsoft.Json.JsonReaderException::Create