I have a string array with 5 items. How to get one of these 5 items by a linq query?
Code below returns only a boolean true.
string[] allWebTemplateSettings =SiteLidmaatschapSettings.Current.ProvisioningSettings;
var webTemplate = allWebTemplateSettings
.Select(x => x.StartsWith(string.Format("Template:{0}", web.WebTemplate)))
.FirstOrDefault();
Use Where
instead of Select
:
var webTemplate = allWebTemplateSettings.Where(x => x.StartsWith(string.Format("Template:{0}", web.WebTemplate))).FirstOrDefault();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With