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: 
vanila js

```
yourObjName.hasOwnProperty(key) : true ? false;

```

If you want to check if the object has at least one property in es2015

```
Object.keys(yourObjName).length : true ? false

```
**yourArray.indexOf(yourArrayKeyName) > -1**

```
fruit = ['apple', 'grapes', 'banana']

fruit.indexOf('apple') > -1

```

*true*

---

```
fruit = ['apple', 'grapes', 'banana']

fruit.indexOf('apple1') > -1

```

*false*

---

for strict object keys checking:

```
const object1 = {};
object1.stackoverflow = 51; 
console.log(object1.hasOwnProperty('stackoverflow')); 

output: true 

```