// Error! Can't return a var data type!
static var GetProjectedSubset()
{
Car[] myCars = new Car[] {
new Car{ PetName = "Henry", Color = "Silver", Speed = 100, Make = "BMW"},
new Car{ PetName = "Daisy", Color = "Tan", Speed = 90, Make = "BMW"},
new Car{ PetName = "Mary", Color = "Black", Speed = 55, Make = "VW"},
new Car{ PetName = "Clunker", Color = "Rust", Speed = 5, Make = "Yugo"},
new Car{ PetName = "Melvin", Color = "White", Speed = 43, Make = "Ford"}
};
C H A P T E R 1 4
■
A N I N T R O D U C T I O N TO L I N Q
470
8849CH14.qxd 9/26/07 12:30 PM Page 470
var makesColors = from c in myCars select new { c.Make, c.Color };
Do'stlaringiz bilan baham: |