SpecDataPoint.CompareTo
Orders two data points by m/z. Intensity is ignored.
Remarks
Orders by Mz. This is the IComparable implementation, so Array.Sort and List.Sort put a set of points into m/z order without a comparer being supplied.
Points with equal Mz compare equal.
Syntax
| Syntax | Description |
|---|---|
| CompareTo(SpecDataPoint x) | Orders data points by m/z alone. Two points at the same m/z compare as equal. |
Parameters
| Name | Type | Description |
|---|---|---|
| x | SpecDataPoint | The data point to compare against. |
Returns
| Type | Description |
|---|---|
| int | Negative, zero or positive as this point’s m/z is less than, equal to or greater than x’s. |
Example
1
2
3
4
5
6
7
8
9
10
11
12
using System;
using Nova.Data;
SpecDataPoint[] peaks =
{
new SpecDataPoint(600.30, 2000.0),
new SpecDataPoint(445.12, 10523.0),
new SpecDataPoint(522.77, 850.0)
};
// IComparable orders by Mz, so no comparer is needed.
Array.Sort(peaks);
This post is licensed under CC BY 4.0 by the author.