Dynamic filter on Array...!

  • Thread starter Thread starter Karthik
  • Start date Start date
K

Karthik

Dear All,

I am using VS 2008.
I have an array of class objects which have 1000 data at time.
I want to filter the records by dynamicaly.
that is, i will give a property name (For ex: StudentName) corresponding
value to find (For ex: "Karthik"), using that i want to filter the records
by, whose StudentName is Karthik..

is this possible?

Regards
Karthik.C
 
Karthik said:
I am using VS 2008.
I have an array of class objects which have 1000 data at time.
I want to filter the records by dynamicaly.
that is, i will give a property name (For ex: StudentName) corresponding
value to find (For ex: "Karthik"), using that i want to filter the records
by, whose StudentName is Karthik..

is this possible?

Absolutely - although it's likely to be slightly ugly.

When the array is *created* is it strongly typed? In other words, does
the type of the array itself know about the property in question?

As an example:

// Tricky (at least to do in a performant manner)
object[] x = new object[1000];
x[0] = new MyClass();

// Easier
object[] x = new MyClass[1000];
x[0] = new MyClass();
 
Back
Top