Creating a Simple C# Wrapper to clean up code
<p>I have this code:</p>

<pre><code>public void Contacts(string domainToBeTested, string[] browserList, string timeOut, int numberOfBrowsers)
    {
        verificationErrors = new StringBuilder();

        for (int i = 0; i &lt; numberOfBrowsers; i++)
        {
            ISelenium selenium = new DefaultSelenium("LMTS10", 4444, browserList[i], domainToBeTested);

            try
            {
                selenium.Start();
                selenium.Open(domainToBeTested);

                selenium.Click("link=Email");
                Assert.IsTrue(selenium.IsElementPresent("//div[@id='tabs-2']/p/a/strong"));

                selenium.Click("link=Address");
                Assert.IsTrue(selenium.IsElementPresent("//div[@id='tabs-3']/p/strong"));

                selenium.Click("link=Telephone");
                Assert.IsTrue(selenium.IsElementPresent("//div[@id='tabs-1']/ul/li/strong"));
            }
            catch (AssertionException e)
            {
                verificationErrors.AppendLine(browserList[i] + " :: " + e.Message);
            }
            finally
            {
                selenium.Stop();
            }
        }
        Assert.AreEqual("", verificationErrors.ToString(), verificationErrors.ToString());
    }
</code></pre>

<p>My problem is i would like to make it so that i can use the code surrounding the 'try' many many times in the rest of the code. I think it has something to do with wrappers, but i can't get a simple answer for this from the web.</p>

<p>So in simple terms the only piece of this code which changes is the bit between the try {} the rest is standard code that i have currently used over 100 times and is turning out to be a pain to maintain.</p>

<p>Hope this is clear, many thanks.</p>
