Post

SpecDataPointEx.CompareTo

Orders data points by m/z alone.


Remarks

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.


Syntax

SyntaxDescription
CompareTo(SpecDataPointEx x)Orders data points by m/z alone. Two points at the same m/z compare as equal.

Parameters

NameTypeDescription
xSpecDataPointExThe data point to compare against.

Returns

TypeDescription
intNegative, 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
using System;
using Nova.Data;

SpecDataPointEx[] peaks =
{
  new SpecDataPointEx(600.30, 2000.0),
  new SpecDataPointEx(445.12, 10523.0),
  new SpecDataPointEx(522.77, 850.0)
};

Array.Sort(peaks);
This post is licensed under CC BY 4.0 by the author.

Trending Tags