Imagine I am doing this:

```
var player = players.FirstOrDefault();

```

Or indeed any complicated LINQ expression where the last function run is `FirstOrDefault`.

After executing it, `player` can `default()`. How do I check for this whilst keeping a `var` style type declaration? Is it even possible in c#?

1.

```
if (player == default(Player))

```

The explicit `Player` makes the `var player` feel useless. I might as well use `Player player = ...` instead of `var player ...`, and the entire question here is how to keep `var` around.

2.

```
if (player == default(typeof(player)))

```

is not compilable. I could do `typeof(Player)` but see above for how pointless that feels.

3.

```
if (player == null)

```

as `default(any reference type)` is `null`. But obviously this isn't correct if Player class is a `struct` type.

I'm aware that I could check the size of the array and THEN do `.First()` or even `.DefaultIfEmpty(something)`, but that makes `.FirstOrDefault()` pointless and in the `.DefaultIfEmpty` case requires you to know the class type, which doesn't obey the `var` limitation of that question.

Is there any way I can write this code using `var` that works fine for all types var could be standing in for?