snipt

Ctrl+h for KB shortcuts

C#

Calling a string.Format with custom formatter

string.Format(new CustomFormatter(), "{0:Format1}", 9.99m);
https://snipt.net/embed/e624a4191d26865a979497f6d8419fc5/
/raw/e624a4191d26865a979497f6d8419fc5/
e624a4191d26865a979497f6d8419fc5
csharp
C#
1
2019-07-12T01:48:11
True
False
False
/api/public/snipt/16160/
calling-a-stringformat-with-custom-formatter
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kt">string</span><span class="p">.</span><span class="n">Format</span><span class="p">(</span><span class="k">new</span> <span class="n">CustomFormatter</span><span class="p">(),</span> <span class="s">&quot;{0:Format1}&quot;</span><span class="p">,</span> <span class="m">9.99</span><span class="n">m</span><span class="p">);</span> </span></pre></div> </td></tr></table>
custom, formatter