ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Difference between !String.IsNullOrEmpty and !='' and !=null in C#<p>Hi <a class="username" rel="Abhays"> Abhays</a>,</p> <blockquote><cite>Abhays says:</cite> <div class="line number2 index1 alt1"><code class="csharp keyword">if</code> <code class="csharp plain">(!</code><code class="csharp keyword">string</code><code class="csharp plain">.IsNullOrEmpty(textbox.Text)) {</code></div> <div class="line number3 index2 alt2"><code class="csharp plain">.........</code></div> <div class="line number4 index3 alt1"><code class="csharp plain">}</code></div> </blockquote> <p>&nbsp;It is used to check whether the specified string is not null or an Empty string.&nbsp; If string is null or an Empty then this statement will not execute.</p> <blockquote><cite>Abhays says:</cite> <div class="line number7 index6 alt2"><code class="csharp spaces">&nbsp;</code><code class="csharp keyword">if</code> <code class="csharp plain">(Textbox.Text != </code><code class="csharp string">""</code><code class="csharp plain">)</code></div> <div class="line number8 index7 alt1"><code class="csharp spaces">&nbsp;</code><code class="csharp plain">{</code></div> <div class="line number9 index8 alt2"><code class="csharp spaces">&nbsp;</code><code class="csharp plain">....</code></div> <div class="line number10 index9 alt1"><code class="csharp spaces">&nbsp;</code><code class="csharp plain">}</code></div> </blockquote> <p>&nbsp;&nbsp;It is used to check whether the specified string is not an Empty string. If string is an Empty then this statement will not execute.</p> <blockquote><cite>Abhays says:</cite> <div class="line number14 index13 alt1"><code class="csharp spaces"></code><code class="csharp keyword">if</code> <code class="csharp plain">(Textbox.Text != </code><code class="csharp keyword">null</code><code class="csharp plain">)</code></div> <div class="line number15 index14 alt2"><code class="csharp spaces">&nbsp;</code><code class="csharp plain">{</code></div> <div class="line number16 index15 alt1"><code class="csharp spaces">&nbsp;</code><code class="csharp plain">....</code></div> <div class="line number17 index16 alt2"><code class="csharp spaces">&nbsp;</code><code class="csharp plain">}</code></div> </blockquote> <p>&nbsp;&nbsp; It is used to check whether the specified string is not null string. If string is null then this statement will not execute.</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/150885/Difference-between-StringIsNullOrEmpty-and-and-null-in-C/https://www.aspforums.net:443/Threads/150885/Difference-between-StringIsNullOrEmpty-and-and-null-in-C/Wed, 15 Aug 2018 23:57:44 GMT