我有以下類:查詢字典特定類成員C#
using System;
using System.Collections.Generic;
namespace ddd
{
public class FPSData
{
private double minFPS;
private double maxFPS;
private double averageFPS;
#region Properties
public double MinFPS
{
get { return minFPS; }
set { minFPS = value; }
}
public double MaxFPS
{
get { return maxFPS; }
set { maxFPS = value; }
}
public double AverageFPS
{
get { return averageFPS; }
set { averageFPS = value; }
}
#endregion Properties
public FPSData(double min, double max, double avg)
{
minFPS = min;
maxFPS = max;
averageFPS = avg;
}
}
}
在我的主要功能,我聲明瞭以下內容:
class Program
{
static void Main(string[] args)
{
Dictionary<uint, FPSData> trying = new Dictionary<uint, FPSData>();
FPSData m1 = new FPSData(1, 2, 3);
FPSData m2 = new FPSData(4, 5, 6);
FPSData m3 = new FPSData(7, 8, 9);
trying.Add(101, m1);
trying.Add(102, m2);
trying.Add(103, m3);
Console.WriteLine("sdfgh");
}
}
我試圖得到一本字典(Dictionary<uint, doubule>
),比方說,只有最小值。
含義,我的字典將具備以下條件:
101, 1
102, 4
103, 7
我試過的LINQ
許多變化,但只是無法得到它的權利。可能嗎?
+1'Console.WriteLine( 「sdfgh」);' – RononDex