Collection.IndexOf Method Question?
-
I can't seem to get my head around the following. My Frequency class has two fields Data1 and Data2. public static List ColourFreqCollection = new List(); ColourFreqCollection.Add(new Frequency(1,2)); ColourFreqCollection.Add(new Frequency(3,2));etc Is it possible to now use the IndexOf method to look in the Frequency objects Data1 field and return the index if a particular number exists? ColourFreqCollection.IndexOf(don't know what to put here! -look in object data1 field and return index if true); Else what would be the best thing to do? Thanks in advance for your help.
Haz
-
I can't seem to get my head around the following. My Frequency class has two fields Data1 and Data2. public static List ColourFreqCollection = new List(); ColourFreqCollection.Add(new Frequency(1,2)); ColourFreqCollection.Add(new Frequency(3,2));etc Is it possible to now use the IndexOf method to look in the Frequency objects Data1 field and return the index if a particular number exists? ColourFreqCollection.IndexOf(don't know what to put here! -look in object data1 field and return index if true); Else what would be the best thing to do? Thanks in advance for your help.
Haz
ColourFreqCollection.IndexOf(new Frequency(1,2)); That's all you can do, you don't have a reference to the object you're looking for.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog