0

I have created a list (dd) which contains instances of a class. I want to be able to perform queries on some of its attributes (eg. finding the smallest numeric value), but cannot find a way to do this using the functionality of the class (I feel like going back to analysing the data by column). How do I access the values in one of the attributes when my instances are now on a list? Thanks!

  • 1
    Specifying what language you are working with might be a useful starting point. Otherwise you might get suggestions from C++, Python, Java, or any other programming language that has the concept of a class and a list in it... Also, showing some code is generally considered useful. – twalberg Feb 05 '15 at 21:29
  • Sorry... this was my first stackoverflow post... Im using python.. – Amaya López-c Feb 05 '15 at 21:56

1 Answers1

0

Assuming you're using C# and having a class like this

class Foo
{
    public double Bar { get; set; }
}

then LINQ is exactly what you are looking for

List<Foo> list = GetList();
var filtered = list.Where(p => p.Bar > 23.0);

Have a look at these examples: https://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b

Jan Köhler
  • 5,817
  • 5
  • 26
  • 35