天天看點

linq 對象轉換

public class IMGInfo

 {

  public DateTime Time;

  public byte Channel;

  public int Size;

 }

public class IMGIndex

        public DateTime Time;

        public byte channel;

        public long start;

        public int len;

}

IMGIndex[] result=new IMGIndex[10];

IMGIndex 2 IMGInfo:

var res = (from n in result select new IMGInfo { Channel = n.channel, Size = n.len, Time = n.Time }).ToArray();

本文轉自94cool部落格園部落格,原文連結:http://www.cnblogs.com/94cool/archive/2012/06/29/2569321.html,如需轉載請自行聯系原作者

繼續閱讀