calling n methods

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
i need to work out a solution to this:
i have a class that is a time series of (double) numbers and i want to do
the following calculation
for
int x;
i need to perform a calculation which will, starting with the last item
added to the time series perform calculations moving backwards through the
timeseries x items back and return these calculations in a new series of data
comprising these x items
 
its a standard net 2.0 container returning a timeseries with dateTime and
value for each element in the array. You can access data in the container by
index (starting from 0. ie

doubleSeries series = new doubleSeries();

// Get second element
double secondValue = series[1];

//Getting the second to last value
for (int i = 1; i < series.Count; i++) {
double value = series;
}

// Get the last value
double lastValue = series.Last;

// Get the first value
double firstValue = series.First;
 
its a standard net 2.0 container returning a timeseries with dateTime and
value for each element in the array. You can access data in the container by
index (starting from 0. ie

doubleSeries series = new doubleSeries();

// Get second element
double secondValue = series[1];

//Getting the second to last value
for (int i = 1; i < series.Count; i++) {
double value = series;

}

// Get the last value
double lastValue = series.Last;

// Get the first value
double firstValue = series.First;

Kevin Spencer said:
That all depends on the structure of your "time series" class.
Kevin Spencer
Microsoft MVP
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net


You can use a for loop backwards:

int x = 5;
for (int i = series.Count - 1; i >= (series.Count - x); i--) {
//perform calculation with series
}

Chris
 
Hi,

What can't you manage to do ?
for int index=list.count-1;i>0;i--
{
[...]
}
where 'list' could be a List<double>

b1uceree wrote :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top