本文整理汇总了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);
}
}
示例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();
}
示例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");
}
示例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;
}
示例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]);
}
示例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;
}
示例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();
}
示例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());
}