<p>I find myself writing delegates occasionally for really simple functions (take no arguments and return void for example) and am wondering if anyone knows someplace that has compiled a list of all the predefined delegates already available in the .NET framework so I can reuse them?</p>

<p>To be clear I am looking for something like this:</p>

<ul>
<li>void System.AsyncCallback(System.IAsyncResult)</li>
<li>int System.Comparison(T x, T y)</li>
<li>void System.IO.ErrorEventHandler(object, System.Io.ErrorEventArgs)</li>
</ul>

<p>and so on</p>

<p>If not, sounds like a good idea for a blog article.</p>

[{'answer_id': 66118, 'author': 'Kent Boogaart', 'author_id': 5380, 'author_profile': 'https://Stackoverflow.com/users/5380', 'pm_score': 2, 'selected': False, 'text': '<p>I have previously blogged along these lines <a href="http://kentb.blogspot.com/2008/01/consolidating-delegates-with-reflector.html" rel="nofollow noreferrer">here</a>. Basically, I describe how you can find an existing delegate to meet your needs using Reflector.</p>\n'}, {'answer_id': 66127, 'author': 'Jorge Córdoba', 'author_id': 2695, 'author_profile': 'https://Stackoverflow.com/users/2695', 'pm_score': 4, 'selected': True, 'text': '<p>Just look in the msdn database for (T) delegate.</p>\n\n<p>Here you got a direct link: <a href="http://social.msdn.microsoft.com/Search/en-us/?Query=(T)%20delegate" rel="noreferrer">List of delegates</a></p>\n\n<p>That should get you started.</p>\n'}, {'answer_id': 66351, 'author': 'Thomas Danecker', 'author_id': 9632, 'author_profile': 'https://Stackoverflow.com/users/9632', 'pm_score': 1, 'selected': False, 'text': '<p>Just use the Action, Action&lt;T&gt;, Action&lt;T1,T2,..&gt; delegates for methods not returning anything (void), or the Func&lt;TResult&gt;, Func&lt;T, TResult&gt;, Func&lt;T1, ..., TResult&gt; delegates for methods returning TResult.</p>\n\n<p>Those delegates are new in .net 3.5.</p>\n'}, {'answer_id': 66425, 'author': 'Yes - that Jake.', 'author_id': 5287, 'author_profile': 'https://Stackoverflow.com/users/5287', 'pm_score': 2, 'selected': False, 'text': "<p>One thing to keep in mind is that you write code to be readable to future coders, including your future self. Even if you can find a built-in delegate with the correct signature in the framework, it's not always correct to use that delegate if it obscures the purpose of the code.</p>\n\n<p>Six months down the road, the use of a delegate of type <em>BondMaturationAction</em> is going to be much clearer than that of one with a type Action, even if the signatures are the same.</p>\n"}, {'answer_id': 67663, 'author': 'Mike Dimmick', 'author_id': 6970, 'author_profile': 'https://Stackoverflow.com/users/6970', 'pm_score': 0, 'selected': False, 'text': '<p>In .NET 2.0 and later, use EventHandler if you have no arguments at all, and EventHandler&lt;T&gt; if you want to provide some custom data (you will need to derive a class from EventArgs with your additional data in it). If you have no EventArgs to use, pass EventArgs.Empty.</p>\n\n<p>Because EventArgs is a reference type, all instances of EventHandler&lt;T&gt; use the same JITted code.</p>\n'}]
['https://Stackoverflow.com/questions/65990', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5056/']