当前位置: 首页>>代码示例>>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;未经允许,请勿转载。