using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Core.Models.PublishedContent
{
///
/// The published content enumerable, this model is to allow ToString to be overriden for value converters to support legacy requests for string values
///
public class PublishedContentEnumerable : IEnumerable
{
///
/// The items in the collection
///
private readonly IEnumerable _items;
///
/// Initializes a new instance of the class.
///
///
/// The published content items
///
public PublishedContentEnumerable(IEnumerable publishedContent)
{
if (publishedContent == null) throw new ArgumentNullException("publishedContent");
_items = publishedContent;
}
///
/// The ToString method to convert the objects back to CSV
///
///
/// The .
///
public override string ToString()
{
return string.Join(",", _items.Select(x => x.Id));
}
///
/// The get enumerator.
///
///
/// The .
///
public IEnumerator GetEnumerator()
{
return _items.GetEnumerator();
}
///
/// The get enumerator.
///
///
/// The .
///
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}