how to remove an element from a list of user define class?

arrays, c#, list

Solution

This will remove all `Level2` objects with `Price = 300 and Volume = 400` from the list

ask.RemoveAll(a => a.price == 300 && a.volume == 400);

Problem

I am fairly new to c#, please be gentle to me, I have been searching through the net for a few hours without success, I want to remove an element from my user defined class. How do I do it? below is the snippet of the code. ``` public class Level2 { public double price { get; set; } public long volume { get; set; } public Level2(double price, long volume) { this.price = price; this.volume = volume; } } static void Main() { List<Level2> bid = new List<Level2>(); ask.Add(new Level2(200, 500)); ask.Add(new Level2(300, 400)); ask.Add(new Level2(300, 600)); // how to remove this element ??? ask.Remove(300, 400); //doesn't work } ``` I think I need to implement IEnumerable of some sort, but how does the syntax look like? can someone please give me a working snippet? thanks a lot

Original source