remove Utilities.DictionaryToList - not needed
This commit is contained in:
@@ -27,25 +27,14 @@ namespace PocketSharp.Models
|
||||
[JsonProperty]
|
||||
public int Since { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the _ item dictionary.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The _ item dictionary.
|
||||
/// </value>
|
||||
[JsonProperty("list")]
|
||||
public Dictionary<string, PocketItem> ItemDictionary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the items.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The items.
|
||||
/// </value>
|
||||
[JsonIgnore]
|
||||
public List<PocketItem> Items
|
||||
{
|
||||
get { return Utilities.DictionaryToList<PocketItem>(ItemDictionary); }
|
||||
}
|
||||
[JsonProperty("list")]
|
||||
[JsonConverter(typeof(ObjectToArrayConverter<PocketItem>))]
|
||||
public List<PocketItem> Items { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ namespace PocketSharp
|
||||
/// converts DateTime to an UNIX timestamp
|
||||
/// </summary>
|
||||
/// <param name="dateTime">The date.</param>
|
||||
/// <returns>UNIX timestamp</returns>
|
||||
/// <returns>
|
||||
/// UNIX timestamp
|
||||
/// </returns>
|
||||
public static int? GetUnixTimestamp(DateTime? dateTime)
|
||||
{
|
||||
if (dateTime == null)
|
||||
@@ -22,30 +24,5 @@ namespace PocketSharp
|
||||
|
||||
return (int)((DateTime)dateTime - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Convert a dictionary to a list
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="items">The items.</param>
|
||||
/// <returns></returns>
|
||||
public static List<T> DictionaryToList<T>(Dictionary<string, T> items) where T : new()
|
||||
{
|
||||
if (items == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var itemEnumerator = items.GetEnumerator();
|
||||
List<T> list = new List<T>();
|
||||
|
||||
while (itemEnumerator.MoveNext())
|
||||
{
|
||||
list.Add(itemEnumerator.Current.Value);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user