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.Get specific items from Generic List collection based on condition using C#<p>Hi <a class="username" rel="susanta"> susanta</a>,</p> <p>Refer below sample code and you will get the filtered records.</p> <pre class="brush: csharp">List&lt;string&gt; listValues = new List&lt;string&gt;(); listValues.Add(&#34;D500&#34;); listValues.Add(&#34;C020&#34;); listValues.Add(&#34;C199&#34;); listValues.Add(&#34;C321&#34;); List&lt;string&gt; filteredList = new List&lt;string&gt;(); foreach (string item in listValues) { string a = item.Substring(0, 1); int numbers = Convert.ToInt32(item.Substring(1, item.Length - 1)); if (a.ToUpper() == &#34;C&#34; &amp;&amp; numbers &gt;= 0 &amp;&amp; numbers &lt;= 199) { filteredList.Add(item); } }</pre> <p><strong><span style="text-decoration: underline;">Input</span></strong></p> <table border="1"> <tbody> <tr> <td>D500</td> </tr> <tr> <td>C020</td> </tr> <tr> <td>C199</td> </tr> <tr> <td>C321</td> </tr> </tbody> </table> <p><strong><span style="text-decoration: underline;">OutPut</span></strong></p> <table border="1"> <tbody> <tr> <td>C020</td> </tr> <tr> <td>C199</td> </tr> </tbody> </table>https://www.aspforums.net:443/Threads/977449/Get-specific-items-from-Generic-List-collection-based-on-condition-using-C/https://www.aspforums.net:443/Threads/977449/Get-specific-items-from-Generic-List-collection-based-on-condition-using-C/Tue, 10 Oct 2017 01:27:33 GMTGet specific items from Generic List collection based on condition using C#<pre class="brush: csharp">var Taglist = from r in mTagsList.AsEnumerable() where Regex.IsMatch(r, &#34;^[C]+([0-1]{1}[0-9]{1,2})$&#34;) select r;</pre> <p>Regular expression @"^[C]+([0-1]{1}[0-9]{1,2})$"</p>https://www.aspforums.net:443/Threads/977449/Get-specific-items-from-Generic-List-collection-based-on-condition-using-C/https://www.aspforums.net:443/Threads/977449/Get-specific-items-from-Generic-List-collection-based-on-condition-using-C/Tue, 10 Oct 2017 04:39:01 GMT