Change min/max in LineBase to use simpler LINQ query
This commit is contained in:
1 parent
e3f744677e
commit
c27ae20b77
1 file changed
+4
-9
@@ -63,15 +63,10 @@ namespace VocaluxeLib.Songs
|
||||
{
|
||||
get
|
||||
{
|
||||
int min = int.MaxValue;
|
||||
int max = int.MinValue;
|
||||
foreach (T note in _Notes)
|
||||
{
|
||||
if (note.Tone < min)
|
||||
min = note.Tone;
|
||||
if (note.Tone > max)
|
||||
max = note.Tone;
|
||||
}
|
||||
if (_Notes.Count == 0)
|
||||
return 0;
|
||||
int min = _Notes.Max(note => note.Tone);
|
||||
int max = _Notes.Min(note => note.Tone);
|
||||
|
||||
return min - (max - min) / 4;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user