Webresponse에서받는 데이터를 정렬하는 데 약간의 문제가 있습니다.Json 데이터 정렬
지금은 "임의"로 나타나며 전혀 정렬 할 수 없었습니다.
는 현재 부분 클래스는 다음과 같습니다
namespace computers{
using System;
using System.Net;
using System.Collections.Generic;
using Newtonsoft.Json;
using J = Newtonsoft.Json.JsonPropertyAttribute;
public partial class GettingStarted
{
[J("devices")] public Device[] Devices { get; set; }
}
public partial class Device
{
[J("device_id")] public string DeviceId { get; set; }
[J("assigned_to")] public bool AssignedTo { get; set; }
[J("alias")] public string Alias { get; set; }
[J("description")] public string Description { get; set; }
[J("last_seen")] public string LastSeen { get; set; }
[J("remotecontrol_id")] public string RemotecontrolId { get; set; }
[J("groupid")] public string Groupid { get; set; }
[J("online_state")] public string OnlineState { get; set; }
[J("supported_features")] public string SupportedFeatures { get; set; }
}
public partial class GettingStarted
{
public static GettingStarted FromJson(string json) => JsonConvert.DeserializeObject<GettingStarted>(json, Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this GettingStarted self) => JsonConvert.SerializeObject(self, Converter.Settings);
}
public class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
};
}
으로 전에 말했듯이, 데이터를 무작위로 제공하고 그들 중 충돌 발생하거나 아무것도하지 않는 정렬에 내 모든 시도.
미리 감사드립니다. 당신은 당신이 당신의 '장치'배열을 pupulate 후이
using System.Linq
지시
를 추가 달성하기 위해 람다 표현식을 사용할 수 있습니다
당신에게 싶어 할 종류? –
필드 '별칭'! – AlWooz
무엇을 시도 했습니까? 몇 가지 예를 보여주십시오. –