How to loop through Dropdown options?

Basically, I have a dropdown UI and on its options are some resolutions I want to loop through this dropdown options using a foreach loop and test the value (Option from dropdown) in an if statment.

I tried the following

foreach (Dropdown.OptionData Options in DropDown.options){
			print(Options.ToString());
		}

and this is what printed out: “UnityEngine.UI.Dropdown+OptionData”

How can I have the actual option I have for the user to be printed out instead of " UnityEngine.UI.Dropdown+OptionData"

There are two properties you can access in the OptionData class, text and image. To get the string value you are looking for you can do something like this:

Dropdown menu = GetComponent<Dropdown>();

foreach(Dropdown.OptionData option in DropDown.options){
    Debug.Log(option.text);
}

Cheers,

TrickyHandz