I have a method which returns the object of type CarsCache. I want to set some properties in my object Vehicle which has object of Car from CarChache object. I can do it easily like below:
var carCahe =  getByCarId(1);
Vehicle v = new Vehicle();
v.Car.value1 = carCahe.value1;
But I want to do it through LINQ.  I have done something like this through LINQ but that method returns the collection and then I use where and select. I have a object Vehicle and there is an object Car in vehicle. I do it like this:
entity = new Vehicle
{
    IsActive = true,
    Car = DataCache.GetInstance()
          .GetAllCars()
          .ToList()
          .Where(o => o.carId== carId)
          .Select(o => new Car{Value1= o.value1, value2= o.value2})
          .Single()
    };
This is also working now I want to do this with method which returns only one object. Not collection but I am unable to do this. I am doing this:
entity =new Vehicle
{
  IsActive = true,
  Car= DataCache.GetInstance() // it retruns carCahe object.
         .GeTCarById(1)
         //Here i want to set value1 property and value2 property
 };
How can I do this?
 
     
     
    