Question: In this code fragment

```
foreach (var row in grid.Rows) { }              

```

the type of row is inferred as Object instead of GridViewRow. I have to explicitly declare the type to work with a GridViewRow:

```
foreach (GridViewRow row in grid.Rows) { }

```

GridView.Rows returns a GridViewRowCollection and GetEnumerator on the collection "Returns an enumerator that contains all GridViewRow objects in the GridViewRowCollection." If I access a single row from the collection by index

```
var row = grid.Rows[0];

```

the type is correctly inferred. Why can't the compiler infer the type for row in the foreach declaration?

Edited to add: Interesting responses, I didn't think to look for the obvious problem. ListView.Items implements `IList<ListViewDataItem>`, so this looks like an oversight to me.

Answer: 
To find if a key exists in an object, use

`Object.keys(obj).includes(key)`

The ES7 [includes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes) method checks if an Array includes an item or not, & is a simpler alternative to `indexOf`.
```
const object1 = {
  a: 'something',
  b: 'something',
  c: 'something'
};

const key = 's';

// Object.keys(object1) will return array of the object keys ['a', 'b', 'c']

Object.keys(object1).indexOf(key) === -1 ? 'the key is not there' : 'yep the key is exist';

```