0 Comments

If you want to find or get an element from a generic list or collection with LINQ and C#, you can use the "First" function:

public ApplicationPool GetApplicationPoolByName(string name)
{
    ApplicationPool applicationPool;
    using (ServerManager manager = new ServerManager())
    {
        applicationPool = manager.ApplicationPools.First(a => a.Name == name);
    }

    return applicationPool;
}

 
 

You can find the Microsoft.Web.Administration.dll in "%windir%\System32\inetsrv".

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Posts