remove Utilities.DictionaryToList - not needed

This commit is contained in:
2013-11-05 23:17:45 +01:00
parent 7147d8022e
commit 82c9ecd6b5
2 changed files with 6 additions and 40 deletions
+3 -14
View File
@@ -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; }
}
}
+3 -26
View File
@@ -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;
}
}
}