Question: I have an array like as below

```
var arr = [ 'type=A', 'day=45' ];
var trans = { 'type': 'A', 'day': 45 }

```

Please write easiest and most efficient way :)

Answer: 
`var` infers the type. If you don't assign a value, it can't infer the type of the value.

You have to create a class or struct and put your fields in there. Then use the type of the created class.
If you really want to use var:

```
 var Rs1 = id != null ?
             _context.DwPropertyDetails.Select(x => new
                {
                    Rs1Clm2 = totalTransAmount,
                    Rs1Clm3 = x.Studio,
                    Rs1Clm4 = x.OneBedroom,
                    Rs1Clm5 = x.TwoBedroom,
                    Rs1Clm6 = x.ThreeBedroom,
                    Rs1Clm7 = x.Total,
                })
           : _context.DwPropertyDetails.Select(x => new
                {
                    Rs1Clm2 = 0,
                    Rs1Clm3 = 0,
                    Rs1Clm4 = 0,
                    Rs1Clm5 = 0,
                    Rs1Clm6 = 0,
                    Rs1Clm7 = 0,
                 });

```