Can anyone tell me how do i convert the below code to linq.I am trying to get the endpoint address from web.config file using contract name.
I need to convert below for each loop to linq .
string csEndPoint =null;
ClientSection clientSettings = ConfigurationManager.GetSection("system.serviceModel/client") as ClientSection;
foreach (ChannelEndpointElement endpoint in clientSettings.Endpoints) {
if (endpoint.Contract == "CsWebService.ICsWebService") {
ccEndPoint = endpoint.Address.ToString();
break;
}
}
clientSettings.Endpoints
only implementedIEnumerable
, notIEnumerable<T>
.