Cześć Mam takie pytanie. Jak sprawdzić czy elementy w liscie nie na chodzą na siebie ?
że wszystkie elementy są jakby jednostajne i nie na chodzą na siebie
public class Entity
{
public int Start { get; set; }
public int End { get; set; }
public Entity(int start, int end)
{
this.Start = start;
this.End = end;
}
}
class Program
{
static void Main(string[] args)
{
List<Entity> list = new List<Entity>()
{
new Entity(1,2),
new Entity(3,4),
new Entity(5,6)
}; //Tutaj jest ok jest zachowany ciąg
List<Entity> list = new List<Entity>()
{
new Entity(1,3),
new Entity(2,4)
}; //Tutaj jest nie ok bo drugi element start jest mniejszy niż 3
}
}
Jak stworzyć metodę która by zwracała true false