snipt

Ctrl+h for KB shortcuts

C#

Return the current method/Module/Page name in c#

1
2
3
//	Useful for error trapping etc to return what method failed etc..

this.GetType().FullName
https://snipt.net/embed/198f3c4d26821443017cd98198277f88/
/raw/198f3c4d26821443017cd98198277f88/
198f3c4d26821443017cd98198277f88
csharp
C#
3
2019-06-06T00:49:52
True
False
False
/api/public/snipt/48577/
return-the-current-methodmodulepage-name-in-c
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">// Useful for error trapping etc to return what method failed etc..</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="k">this</span><span class="p">.</span><span class="n">GetType</span><span class="p">().</span><span class="n">FullName</span> </span></pre></div> </td></tr></table>
.net, c#