存储Linq会产生预定义的List

时间:2018-04-17 02:34:12

标签: c# linq

我有一个已定义的类 -

class Adjustments
    {
        public int AdjustmentID;
        public int AdjustmentTypeID;    
    }

class AdjustmentsList
    {
        public List<Adjustments> items = new List<Adjustments>();        
    }

如果我进行如下查询:

var Day0Spot =
                (from a in a1
                 join fx in q
                     on a.CurrencyCodeID equals fx.CurrencyCodeID
                 select new
                 {
                     a.AdjustmentID,
                     a.AdjustmentTypeID
}).ToList();

我似乎无法找到使Day0Spot成为AdjustmentsList类型的方法 所有这一切的最终目标是通过某种机制将Day0Spot(以及一些其他类似的列表)添加到AdjustmentsList项(我们称之为MasterList)(看起来像concat会让我在那里)。

编辑 - 我想我可以使用每个并循环通过Day0Spot并手动添加到MasterList,但这看起来很傻

1 个答案:

答案 0 :(得分:1)

我可以试试这个。

创建 String url = "YOUR_URL"; MediaPlayer myMediaPlayer = new MediaPlayer(); myMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); try { myMediaPlayer.setDataSource(url); myMediaPlayer.prepareAsync(); } catch (IOException e) { Toast.makeText(this, "mp3 not found", Toast.LENGTH_SHORT).show(); } myMediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer player) { player.start(); } }); 对象并在linq中填充数据,然后使用新的Adjustments对象来携带List。

AdjustmentsList