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


C# JObject.Values方法代碼示例

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


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

示例1: OnHandle

    public override void OnHandle(IStore store,
                                  string collection,
                                  JObject command,
                                  JObject document)
    {
      IObjectStore st = store.GetCollection(collection);

      if (document.Type == JTokenType.Array)
      {
        var documents = document.Values();
        if (documents != null)
          foreach (JObject d in documents)
          {
            var k = d.Property(DocumentMetadata.IdPropertyName);
            if (k != null)
              st.Set((string)k, d);
          }

      }
      else
      {
        var k = document.Property(DocumentMetadata.IdPropertyName);
        if (k != null)
          st.Set((string)k, document);
      }
    }
開發者ID:dronab,項目名稱:DensoDB,代碼行數:26,代碼來源:SetManyHandler.cs

示例2: UmbracoGalleryBlock

 internal UmbracoGalleryBlock(string type, JObject obj, JObject data)
     : base(type, obj)
 {
     Items = (
         from JObject child in data.Values()
         select new UmbracoMediaItem(child)
     ).ToArray();
 }
開發者ID:karltynan,項目名稱:SirTrevor-for-Umbraco,代碼行數:8,代碼來源:UmbracoGalleryBlock.cs

示例3: CardSet

        public CardSet(JObject jObject)
        {
            Id = jObject.Value<string>("id");
            Name = jObject.Value<string>("name");
            Type = jObject.Value<string>("type");
            Block = jObject.Value<string>("block");
            Description = jObject.Value<string>("description");
            DateReleased = jObject.Value<DateTime>("releasedAt");

            cardIds = jObject.Values<int>("cardIds");
        }
開發者ID:JustynaJuza,項目名稱:Magic,代碼行數:11,代碼來源:CardSet.cs

示例4: ConvertJsonToOrder

        public static Order ConvertJsonToOrder(JObject jOrder)
        {
            var order = new Order();
            var values = jOrder.Values().ToList();

            foreach(var value in values)
            {
                if(value.Path.Equals("Items", StringComparison.OrdinalIgnoreCase))
                {
                    order.Items = ConvertJsonToOrderItems(value);
                }
                if (value.Path.Equals("Id", StringComparison.OrdinalIgnoreCase))
                {
                    order.Id = new Guid(value.Value<JToken>("id").ToString());
                }
            }

            return order;
        }
開發者ID:hanjia2014,項目名稱:HotmenuApp.rc1,代碼行數:19,代碼來源:Order.cs

示例5: Ordering

        public void Ordering()
        {
            JObject o = new JObject(
                new JProperty("Integer", new JValue(1)),
                new JProperty("Float", new JValue(1.2d)),
                new JProperty("Decimal", new JValue(1.1m))
                );

            IList<object> orderedValues = o.Values().Cast<JValue>().OrderBy(v => v).Select(v => v.Value).ToList();

            Assert.AreEqual(1L, orderedValues[0]);
            Assert.AreEqual(1.1m, orderedValues[1]);
            Assert.AreEqual(1.2d, orderedValues[2]);
        }
開發者ID:NiklasGillstrom,項目名稱:Newtonsoft.Json,代碼行數:14,代碼來源:JValueTests.cs

示例6: GetStandAloneChecks

        public static List<JObject> GetStandAloneChecks(JObject obj)
        {
            var  standAloneChecks = new List<JObject>();
            if (obj == null)
                return standAloneChecks;

            try
            {
                
                standAloneChecks = obj.Values<JToken>().Values<JObject>()
                     .Where(n => n["standalone"].Value<bool>()).
                     Select(n => JObject.FromObject(new { name = ((JProperty)n.Parent).Name, command = n["command"], interval = n["interval"] })).ToList();
            }
            catch (Exception)
            {
                Log.Debug("No standalone checks fount!");
            }
            return standAloneChecks;

        }
開發者ID:fhoek,項目名稱:sensu-client,代碼行數:20,代碼來源:SensuClientHelper.cs

示例7: GetCheckByName

 public static JObject GetCheckByName(JObject check, JObject checks)
 {
     return checks.Values<JToken>().Values<JObject>().
         Where(n => ((JProperty)n.Parent).Name == check["name"].Value<string>()).
         Select(n => n).FirstOrDefault();
 
 }
開發者ID:fhoek,項目名稱:sensu-client,代碼行數:7,代碼來源:SensuClientHelper.cs

示例8: AddFromJObject

        /// <summary>
        /// 從對象添加
        /// </summary>
        /// <param name="table"></param>
        /// <param name="value"></param>
        private static void AddFromJObject(DataTable table, JObject value)
        {
            foreach (var kv in value)
            {
                table.Columns.Add(kv.Key);
            }

            table.Rows.Add(value.Values().ToArray());
        }
開發者ID:rajayaseelan,項目名稱:mysoftsolution,代碼行數:14,代碼來源:frmInvoke.cs


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