I have a list of Pieces. I want an int[] of PieceID;
I try this, but this create an anonymous type[].
PiecesTop1 = new List<Piece>();
var test = PiecesTop1.Select(x => new {x.PieceID}).ToArray();
Then I found this syntaxis and works ok.
var lstPieceID = from p in PiecesTop1
select p.PieceID;
int[] arrPieceID = lstPieceID.ToArray();
int i = arrPieceID[0];
I usually use first sintaxis so not familiar with second one.
First question: How I make first sql to return an int[].
Second question: How can I call each of those sql query type to difference beetween them?
Is there any diference on what sintaxis should I use (just in case I'm not using any database).