本文整理汇总了C#中Newtonsoft.Json.Linq.JObject.GetArray方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.GetArray方法的具体用法?C# JObject.GetArray怎么用?C# JObject.GetArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newtonsoft.Json.Linq.JObject
的用法示例。
在下文中一共展示了JObject.GetArray方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
internal static TweetEntities Parse(JObject obj)
{
return new TweetEntities {
HashTags = obj.GetArray("hashtags", TweetHashTag.Parse),
Symbols = new object[0],
Urls = obj.GetArray("urls", TweetUrl.Parse),
Mentions = obj.GetArray("user_mentions", TweetUserMention.Parse)
};
}
示例2: Parse
internal static TweetHashTag Parse(JObject obj)
{
JArray array = obj.GetArray("indices");
return new TweetHashTag {
Text = obj.GetString("text"),
Indices = new[] {
array.GetInt32(0),
array.GetInt32(1)
}
};
}
示例3: SpotifyArtist
private SpotifyArtist(JObject obj) : base(obj) {
ExternalUrls = obj.GetObject("external_urls", SpotifyArtistUrlCollection.Parse);
Followers = obj.GetObject("followers", SpotifyFollowers.Parse);
Genres = obj.GetStringArray("genres");
Href = obj.GetString("href");
Id = obj.GetString("id");
Images = obj.GetArray("images", SpotifyImage.Parse);
Name = obj.GetString("name");
Popularity = obj.GetInt32("popularity");
Type = obj.GetString("type");
Uri = obj.GetString("uri");
}
示例4: Parse
internal static TweetUrl Parse(JObject obj)
{
JArray array = obj.GetArray("indices");
return new TweetUrl {
Url = obj.GetString("url"),
ExpandedUrl = obj.GetString("expanded_url"),
DisplayUrl = obj.GetString("display_url"),
Indices = new[] {
array.GetInt32(0),
array.GetInt32(1)
}
};
}
示例5: Parse
internal static TweetUserMention Parse(JObject obj)
{
JArray array = obj.GetArray("indices");
return new TweetUserMention {
ScreenName = obj.GetString("screen_name"),
Name = obj.GetString("name"),
Id = obj.GetInt64("id"),
Indices = new[] {
array.GetInt32(0),
array.GetInt32(1)
}
};
}
示例6: Parse
/// <summary>
/// Parses a section from the specified <code>obj</code>.
/// </summary>
/// <param name="model">The parent model of the section.</param>
/// <param name="obj">The instance of <code>JObject</code> to be parsed.</param>
public static GridSection Parse(GridDataModel model, JObject obj) {
// Some input validation
if (obj == null) throw new ArgumentNullException("obj");
// Parse basic properties
GridSection section = new GridSection(obj) {
Model = model,
Grid = obj.GetInt32("grid")
};
// Parse the rows
section.Rows = obj.GetArray("rows", x => GridRow.Parse(section, x)) ?? new GridRow[0];
// Update "PreviousRow" and "NextRow" properties
for (int i = 1; i < section.Rows.Length; i++) {
section.Rows[i - 1].NextRow = section.Rows[i];
section.Rows[i].PreviousRow = section.Rows[i - 1];
}
// Return the section
return section;
}
示例7: Parse
public static GridDataModel Parse(JObject obj) {
if (obj == null) return null;
return new GridDataModel(obj) {
Raw = obj.ToString(),
Name = obj.GetString("name"),
Sections = obj.GetArray("sections", x => GridSection.Parse(null, obj)) ?? new GridSection[0]
};
}
示例8: ImagePickerList
/// <summary>
/// Initializes a new instance based on the specified <see cref="JObject" />.
/// </summary>
/// <param name="obj">An instance of <see cref="JObject" /> representing the image picker list.</param>
protected ImagePickerList(JObject obj) {
JObject = obj;
Title = obj.GetString("title") ?? "";
Items = (obj.GetArray("items", ImagePickerItem.Parse) ?? new ImagePickerItem[0]).Where(x => x.IsValid).ToArray();
}
示例9: OpeningHoursWeekdayItem
protected OpeningHoursWeekdayItem(JObject obj) : base(obj) {
Label = obj.GetString("label") ?? "";
Items = obj.GetArray("items", OpeningHoursTimeSlot.Parse);
ParseLegacyValues();
}
示例10: Parse
/// <summary>
/// Parses a row from the specified <code>obj</code>.
/// </summary>
/// <param name="section">The parent section of the row.</param>
/// <param name="obj">The instance of <code>JObject</code> to be parsed.</param>
public static GridRow Parse(GridSection section, JObject obj) {
// Some input validation
if (obj == null) throw new ArgumentNullException("obj");
// Parse basic properties
GridRow row = new GridRow(obj) {
Section = section,
Id = obj.GetString("id"),
Alias = obj.GetString("alias"),
Name = obj.GetString("name"),
Styles = obj.GetObject("styles", GridDictionary.Parse),
Config = obj.GetObject("config", GridDictionary.Parse)
};
// Parse the areas
row.Areas = obj.GetArray("areas", x => GridArea.Parse(row, x)) ?? new GridArea[0];
// Update "PreviousArea" and "NextArea" properties
for (int i = 1; i < row.Areas.Length; i++) {
row.Areas[i - 1].NextArea = row.Areas[i];
row.Areas[i].PreviousArea = row.Areas[i - 1];
}
// Return the row
return row;
}
示例11: SpotifyArtistCollection
private SpotifyArtistCollection(JObject obj) : base(obj) {
Artists = obj.GetArray("artists", SpotifyArtist.Parse);
}
示例12: Parse
/// <summary>
/// Parses an area from the specified <code>obj</code>.
/// </summary>
/// <param name="row">The parent row of the area.</param>
/// <param name="obj">The instance of <code>JObject</code> to be parsed.</param>
public static GridArea Parse(GridRow row, JObject obj) {
// Some input validation
if (obj == null) throw new ArgumentNullException("obj");
// Parse the array of allow blocks
JArray allowed = obj.GetArray("allowed");
// Parse basic properties
GridArea area = new GridArea(obj) {
Row = row,
Grid = obj.GetInt32("grid"),
AllowAll = obj.GetBoolean("allowAll"),
Allowed = allowed == null ? new string[0] : allowed.Select(x => (string)x).ToArray(),
Styles = obj.GetObject("styles", GridDictionary.Parse),
Config = obj.GetObject("config", GridDictionary.Parse)
};
// Parse the controls
area.Controls = obj.GetArray("controls", x => GridControl.Parse(area, x)) ?? new GridControl[0];
// Update "PreviousArea" and "NextArea" properties
for (int i = 1; i < area.Controls.Length; i++) {
area.Controls[i - 1].NextControl = area.Controls[i];
area.Controls[i].PreviousControl = area.Controls[i - 1];
}
// Return the row
return area;
}