Reputation: 612
i had to wait 8 hours to replay to u guys, thats why i edit my post here. here is the whole question; this the first time i works with BindingList and i have no idea about how it works, and i don't find a good explanation.. @Damian • Add to 'My Classes' to a class XYData which has an automatic property 'data' of type BindingList • Make a default constructor that initializes the 'data' to an empty list •make a method 'setData' that takes two fields of type double and puts 'data' to show consistent with them. If the two fields are different lengths, an exception of type ArgumentException is thrown.
• Make second constructor that takes two fields of type double and calls the 'setData' with these • Write an instance method Find Peaks that finds maxima in the data and returns an array of type double containing the x-coordinates of the peaks. • Write an instance method that returns a new instance of XYData containing the square of 'Data' i already declared the binding list here is the code:
public BindingList <PointD> data {get; set;}
// constructor
public XYData() {
data = new BindingList <PointD>();
data.clear();
}
public void setData (double [] flt1, double [] flt2){
// here i don't know how to continue,, am new to c# :(
}
Upvotes: 0
Views: 412
Reputation: 101701
Do you want something like this ?
if(flt1.Length != flt2.Length)
throw new ArgumentException("message");
var resultList = (from x in flt1
from y in flt2
select new PointD { X = x, Y = y }).ToList() // set properties
Upvotes: 0