开发者

Is it possible to Take object members directly from a queue of type object?

If I where to have a Queue holding a collection of objects (Custom object,bool,bool,bool,bool) and the custom object holds three doubles itself.

Can I use the .Take(IntegerValue) command to only take one of the doubles (for the specified take length) from the custom entity containe开发者_运维问答d in the queue and cast it to a double array, possibly with the .ToArray<double> function?


If your custom object contains a double array, then you can do something like this:

queue.OfType<CustomObject>().Select(o => o.doubleArray[0]).Take(1).ToArray();


queue.Select(o => o.Member).Take(integerValue).ToArray();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜