Javascript's void in C#?
<p>Is there something like Javascript's <code>void</code> operator in C#?<br>
Javascript's <a href="https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/void" rel="nofollow"><code>void</code></a>, "evaluates an expression and discards the result, returning <code>undefined</code>". Thus, I'm looking for something built-in that "evaluates" and returns <code>null</code>, or maybe the type default. (So it should sort of be like the inverse of the null-coalescing <code>??</code> operator.)</p>

<p>Example use:</p>

<pre><code>Person a;

public void main() {
    var x = void(a = new Person());
    // x should contain null
}

class Person { }
</code></pre>

<p>(Example does not compile due to illegitimate use of keyword "void", naturally.)</p>

<p>I currently use this—which works—but feels crufty:</p>

<pre><code>protected object voided(object ob) {
    return null;
}
</code></pre>

<hr>

<p>Edit. Ok, so I definitely need to add some more details. I'm using the code in an inline DataBind expression in ASP.NET code. E.g.:</p>

<pre><code>&lt;asp:Repeater runat="server"&gt;
   &lt;ItemTemplate&gt;
       &lt;/tr&gt;&lt;%# voided(globalPersonVariable = (Person)Container.DataItem)) %&gt;&lt;/tr&gt;
   &lt;/ItemTemplate&gt;
&lt;/asp:Repeater&gt;
</code></pre>

<p>Using <code>default</code>, unfortunately does not work here.<br>
(I didn't include this additional information the first time, because I wanted to keep it a "pure" C#-question, not ASP.NET.)</p>
