當前位置: 首頁>>代碼示例>>C#>>正文


C# JConstructor.ReadTokenFrom方法代碼示例

本文整理匯總了C#中Newtonsoft.Json.Linq.JConstructor.ReadTokenFrom方法的典型用法代碼示例。如果您正苦於以下問題:C# JConstructor.ReadTokenFrom方法的具體用法?C# JConstructor.ReadTokenFrom怎麽用?C# JConstructor.ReadTokenFrom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Newtonsoft.Json.Linq.JConstructor的用法示例。


在下文中一共展示了JConstructor.ReadTokenFrom方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Load

        /// <summary>
        /// Loads an <see cref="JConstructor"/> from a <see cref="JsonReader"/>. 
        /// </summary>
        /// <param name="reader">A <see cref="JsonReader"/> that will be read for the content of the <see cref="JConstructor"/>.</param>
        /// <param name="settings">The <see cref="JsonLoadSettings"/> used to load the JSON.
        /// If this is null, default load settings will be used.</param>
        /// <returns>A <see cref="JConstructor"/> that contains the JSON that was read from the specified <see cref="JsonReader"/>.</returns>
        public new static JConstructor Load(JsonReader reader, JsonLoadSettings settings)
        {
            if (reader.TokenType == JsonToken.None)
            {
                if (!reader.Read())
                    throw JsonReaderException.Create(reader, "Error reading JConstructor from JsonReader.");
            }

            while (reader.TokenType == JsonToken.Comment)
            {
                reader.Read();
            }

            if (reader.TokenType != JsonToken.StartConstructor)
                throw JsonReaderException.Create(reader, "Error reading JConstructor from JsonReader. Current JsonReader item is not a constructor: {0}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType));

            JConstructor c = new JConstructor((string)reader.Value);
            c.SetLineInfo(reader as IJsonLineInfo);

            c.ReadTokenFrom(reader, settings);

            return c;
        }
開發者ID:b-bot-110,項目名稱:Newtonsoft.Json,代碼行數:30,代碼來源:JConstructor.cs

示例2: Load

        /// <summary>
        /// Loads an <see cref="JConstructor"/> from a <see cref="JsonReader"/>. 
        /// </summary>
        /// <param name="reader">A <see cref="JsonReader"/> that will be read for the content of the <see cref="JConstructor"/>.</param>
        /// <returns>A <see cref="JConstructor"/> that contains the JSON that was read from the specified <see cref="JsonReader"/>.</returns>
        public static new JConstructor Load(JsonReader reader)
        {
            if (reader.TokenType == JsonToken.None)
            {
            if (!reader.Read())
            throw new Exception("Error reading JConstructor from JsonReader.");
            }

            if (reader.TokenType != JsonToken.StartConstructor)
            throw new Exception("Error reading JConstructor from JsonReader. Current JsonReader item is not a constructor: {0}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType));

            JConstructor c = new JConstructor((string)reader.Value);
            c.SetLineInfo(reader as IJsonLineInfo);

            c.ReadTokenFrom(reader);

            return c;
        }
開發者ID:ThePiachu,項目名稱:BitNet,代碼行數:23,代碼來源:JConstructor.cs

示例3: Load

 public static JConstructor Load(JsonReader reader)
 {
   if (reader.TokenType == JsonToken.None && !reader.Read())
     throw JsonReaderException.Create(reader, "Error reading JConstructor from JsonReader.");
   while (reader.TokenType == JsonToken.Comment)
     reader.Read();
   if (reader.TokenType != JsonToken.StartConstructor)
     throw JsonReaderException.Create(reader, StringUtils.FormatWith("Error reading JConstructor from JsonReader. Current JsonReader item is not a constructor: {0}", (IFormatProvider) CultureInfo.InvariantCulture, (object) reader.TokenType));
   JConstructor jconstructor = new JConstructor((string) reader.Value);
   jconstructor.SetLineInfo(reader as IJsonLineInfo);
   jconstructor.ReadTokenFrom(reader);
   return jconstructor;
 }
開發者ID:tanis2000,項目名稱:FEZ,代碼行數:13,代碼來源:JConstructor.cs


注:本文中的Newtonsoft.Json.Linq.JConstructor.ReadTokenFrom方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。