<p>I'm bored with surrounding code with try catch like this..</p>

<pre><code>try
{
    //some boring stuff
}
catch(Exception ex)
{
    //something even more boring stuff
}
</code></pre>

<p>I would like something like</p>

<pre><code>SurroundWithTryCatch(MyMethod)
</code></pre>

<p>I know I can accomplish this behaviour by creating a delegate with the exact signature of the function, but creating a delegate for all the methods in my application it's just not an option.</p>

<p>I can also do this by injecting IL code but this is expensive in terms of performance as it creates an wrapper assembly around mine.</p>

<p>Any other valid ideeas?</p>

You can try to use some null validiation instead. I can take a LINQ to SQL example:
```
```
var user = db.Users.SingleOrDefault(u => u.Username == 3);

if (user == null)
    throw new ArgumentNullException("User", "User cannot be null.");

// "else" continue your code...
```
```