本文整理汇总了C#中JToken.Name方法的典型用法代码示例。如果您正苦于以下问题:C# JToken.Name方法的具体用法?C# JToken.Name怎么用?C# JToken.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JToken
的用法示例。
在下文中一共展示了JToken.Name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogBoatEvent
private void LogBoatEvent(JToken boat, string doorName, RfidEvent ev)
{
if (boat != null)
{
this.telemetryClient.TrackEvent(
ev.EventType,
new Dictionary<string, string>
{
["ClubId"] = this.currentClub.Id,
["Timestamp"] = ev.Timestamp.Value.ToString(),
["TagId"] = ev.Id,
["BoatName"] = boat.Name(),
["DoorName"] = doorName
});
}
else
{
this.telemetryClient.TrackEvent(
"new_tag",
new Dictionary<string, string>
{
["ClubId"] = this.currentClub.Id,
["Timestamp"] = ev.Timestamp.Value.ToString(),
["DoorName"] = doorName,
["TagId"] = ev.Id,
});
}
}
示例2: GetBoatNames
private static IEnumerable<string> GetBoatNames(JToken boat)
{
yield return boat.Name();
// Start with the set of alternate names (if any) for the boat
var boatNames = (boat
.Value<JArray>("customAttributes")
.Where(x => x.Value<string>("label") == "Alternate names")
.First()
.Value<string>("value") ?? string.Empty)
.Split(',')
.Where(s => !string.IsNullOrEmpty(s));
foreach (var boatname in boatNames)
{
yield return boatname;
}
}