📅  最后修改于: 2022-03-11 14:57:58.596000             🧑  作者: Mango
IndexOf:
// returns a list of the text properties of the options
var listAvailableStrings = dropdown.options.Select(option => option.text).ToList();
// returns the index of the given string
dropdown.value = listAvailableStrings.IndexOf("an Option");
FindIndex
dropdown.value = dropdown.options.FindIndex(option => option.text == "an Option");