using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyCode.Project.Infrastructure.Common { public class Item : IComparable { /// /// 文本 /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string Text { get; set; } /// /// 值 /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public object Value { get; set; } /// /// 排序号 /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public int? SortId { get; set; } /// /// 组 /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string Group { get; } /// /// 禁用 /// [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public bool? Disabled { get; } /// /// 初始化一个类型的实例 /// /// 文本 /// 值 /// 排序号 /// 组 /// 禁用 public Item(string text, object value, int? sortId = null, string group = null, bool? disabled = null) { Text = text; Value = value; SortId = sortId; Group = group; Disabled = disabled; } /// /// 比较 /// /// 其他列表项 /// public int CompareTo(Item other) { return string.Compare(Text, other.Text, StringComparison.CurrentCulture); } } }