How to compare UnityEngine.Resolution with itself?

The code in question:

foreach (Resolution res in Screen.resolutions)
	if (Screen.currentResolution == res)
		index = Array.IndexOf(Screen.resolutions, res);


The If-line produces the following error message:

error CS0019: Operator ‘==’ cannot be applied to operands of type ‘UnityEngine.Resolution’ and ‘UnityEngine.Resolution’

This doesn’t make sense to me. Can anybody please help?

Edit: reslist is a local List<string>

You can use alternative. Here

First. Use System linq

using System.Linq;

Then replace all for each code. With this code.

Screen.resolutions.ToList().Foreach(res => reslist.Add(res.ToString()));
index = Screen.resolutions.ToList().IndexOf(Screen.currentResolution);