If you want to determine if an element in a generic list or collection exists, use the "Any" function with a lambda expression, like:

        public bool Exists(string name)
            bool result = false;

            using (ServerManager manager = new ServerManager())
                result = manager.ApplicationPools.Any(a => a.Name == name);

            return result;

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.