<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>VBForums - C#</title>
		<link>https://www.vbforums.com/</link>
		<description>This forum is for all C# questions.</description>
		<language>en</language>
		<lastBuildDate>Thu, 04 Jun 2026 01:19:10 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>https://www.vbforums.com/images/misc/rss.png</url>
			<title>VBForums - C#</title>
			<link>https://www.vbforums.com/</link>
		</image>
		<item>
			<title>Iterate a list and remove something (member?) if null</title>
			<link>https://www.vbforums.com/showthread.php?912006-Iterate-a-list-and-remove-something-(member-)-if-null&amp;goto=newpost</link>
			<pubDate>Wed, 06 May 2026 14:16:00 GMT</pubDate>
			<description><![CDATA[Sorry about the stupid title.  I don't know what the "something" is.

I'm working with a web application so I run a database query asyncronously and get back a datatype "var" like so: 
var data = await connection.QueryAsync<T>(sql);

Attachment 196012 (https://www.vbforums.com/attachment.php?attachmentid=196012)

The bottom half of the snip is what the debugger shows me when I hit View.   You can see that I highlighted ProjectListModel.rolePMA.  It is null for every list item.  So I want to remove it from the list.  Not the whole row just that member of every row.  Is it possible to do this? The web page is going to display a grid from these query results and there is no need to have a column in the grid that is always null.  My idea was to convert the list to a datatable and then I think I know how to process the datatable and remove the column (I think it would be a column) and convert the datatable back to a list.  But I wanted to ask if this approach is correct and/or is there a better way?

Thank you!]]></description>
			<content:encoded><![CDATA[<div>Sorry about the stupid title.  I don't know what the &quot;something&quot; is.<br />
<br />
I'm working with a web application so I run a database query asyncronously and get back a datatype &quot;var&quot; like so: <br />
var data = await connection.QueryAsync&lt;T&gt;(sql);<br />
<br />
<img src="https://www.vbforums.com/attachment.php?attachmentid=196012&amp;d=1778076473" border="0" alt="Name:  Iterate and Remove Null.jpg
Views: 139
Size:  45.4 KB"  /><br />
<br />
The bottom half of the snip is what the debugger shows me when I hit View.   You can see that I highlighted ProjectListModel.rolePMA.  It is null for every list item.  So I want to remove it from the list.  Not the whole row just that member of every row.  Is it possible to do this? The web page is going to display a grid from these query results and there is no need to have a column in the grid that is always null.  My idea was to convert the list to a datatable and then I think I know how to process the datatable and remove the column (I think it would be a column) and convert the datatable back to a list.  But I wanted to ask if this approach is correct and/or is there a better way?<br />
<br />
Thank you!</div>


	<div style="padding:10px">

	

	
		<fieldset class="fieldset">
			<legend>Attached Images</legend>
				<div style="padding:10px">
				<img class="attach" src="https://www.vbforums.com/attachment.php?attachmentid=196012&amp;stc=1&amp;d=1778076473" alt="" />&nbsp;
			</div>
		</fieldset>
	

	

	

	</div>
]]></content:encoded>
			<category domain="https://www.vbforums.com/forumdisplay.php?30-C">C#</category>
			<dc:creator>MMock</dc:creator>
			<guid isPermaLink="true">https://www.vbforums.com/showthread.php?912006-Iterate-a-list-and-remove-something-(member-)-if-null</guid>
		</item>
	</channel>
</rss>
