using Store.Product.Models.Product.Image;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Store.Product.Models.Product
{
///
/// 主图集合
///
public class MainImageCollection : List
{
///
/// 随机排序
///
public void RandomSort()
{
Random random = new Random();
List newList = new List();
foreach (ProductImage item in this.Take(4))
{
newList.Insert(random.Next(newList.Count + 1), item);
}
if (this.Count == 5)
{
newList.Add(this.Last());
}
this.Clear();
this.AddRange(newList);
}
}
}