查询多个表并将查询发送到字典

Query multiple tables and send query to Dictionary

我正在尝试查询多个 table 并将查询保存为全局字典以供进一步处理。我尝试了以下方法,但我在字典中得到的不是值而是 class 名称。请看一看,告诉我哪里出了问题,以及在哪里可以阅读更多关于 todictionary 查询的信息?

  public class linqtosql
{
    public Dictionary<int, MC_VARIABLES> dctMC = new Dictionary<int, MC_VARIABLES>();

    public class MC_VARIABLES
    {
        public int ID { get; set; }
        public int UDLY_LAST { get; set; }
        public int STRIKE { get; set; }
        public decimal SKEW_A { get; set; }
        public decimal SKEW_B { get; set; }
        public double SKEW_C { get; set; }
    }

    public void GET_DATA()
    {

        var qryBOOK = from B in Globals.DATA.BOOKs
                      from O in Globals.DATA.OPTIONs
                      from U in Globals.DATA.UDLies
                      from S in Globals.DATA.SKEWs
                      where B.CONTRACT == O.CONTRACT
                      where O.UDLY_SYMBOL == U.UDLY_SYMBOL
                      where O.CONTRACT == S.CONTRACT
                      select new MC_VARIABLES
                      { ID = B.ID, STRIKE = (int)B.STRIKE, SKEW_A = (decimal)S.SKEW_A };

        dctMC = qryBOOK.ToDictionary(x => x.ID, x => x);

        foreach (KeyValuePair<int, MC_VARIABLES> KVP in dctMC)
        {
            var key = KVP.Key;
            var item = KVP.Value.SKEW_A;
        }
    }
}

应该是x => x而不是x => MC_VARIABLES,这里x的类型是MC_VARIABLES。

qryBOOK.ToDictionary(x => x.ID, x => x)