TSpectrum<T>.Resize
Replaces the data points with a new, empty array of the given size.
Remarks
Existing points are discarded, and Count is set to the new size. Use Resize rather than assigning DataPoints directly, which does not update Count.
Inherited by Spectrum and SpectrumEx.
Syntax
| Syntax | Description |
|---|---|
| Resize(int sz) | Replaces the data points with a new, empty array of the given size. Existing points are discarded. |
Parameters
| Name | Type | Description |
|---|---|---|
| sz | int | The new number of data points. |
Example
1
2
3
4
5
6
7
8
9
using Nova.Data;
Spectrum spectrum = new Spectrum();
// Assigning DataPoints directly does not update Count, so size with Resize.
spectrum.Resize(2);
spectrum.DataPoints[0] = new SpecDataPoint(445.12, 10523.0);
spectrum.DataPoints[1] = new SpecDataPoint(522.77, 850.0);
Console.WriteLine(spectrum.Count); // 2
This post is licensed under CC BY 4.0 by the author.