ConfigurationElementCollection and Linq
Okay, given that it’s all weakly typed, you’ll need to either call Cast<> or OfType<> explicitly, or give an explicit type to the range variable. You’ll also need to specify the ServerCollection property on your ServerDetails. For example: ServerDetails servers = (ServerDetails) ConfigurationManager.GetSection(“serverDetails”); var server = from ServerElement s in servers.ServerCollection where s.Name == serverName … Read more