Is it possible to pass properties as parameters
<p>If this sounds too impossible, pls dont down vote :) Just my quirk that I wonder if ever I can pass a property as the parameter to a function to get some result.</p>

<p>For eg.</p>

<pre><code>            void delete_button_click (){
            foreach (DataGridViewRow row in dgvRecords.SelectedRows)
                dgvRecords.Rows.Remove(row);
            }
</code></pre>

<p>And suppose</p>

<pre><code>           void delete_all_button click (){
            foreach (DataGridViewRow row in dgvRecords.Rows)
                dgvRecords.Rows.Remove(row);
            }
</code></pre>

<p>Can I write the above two codes in one function since the only difference is <code>SelectedRows</code> and <code>Rows</code>. Something like this:</p>

<pre><code>            void button_click (//DataGridView property rows){
            foreach (DataGridViewRow row in dgvRecords.rows)
                dgvRecords.Rows.Remove(row);
            }
</code></pre>

<p>And call it </p>

<pre><code>       {
           button_click(DataGridView.Rows);
           //and
           button_click(DataGridView.SelectedRows);
       }
</code></pre>

<p>Another eg.,</p>

<pre><code>    decimal GetAmount1(User usr)
    {
        decimal sum = 0;
        foreach (DataGridViewRow row in dgvRecords.Rows)
        {
            Tuple&lt;User, User, Notification, Acknowledgment&gt; tup = (Tuple&lt;User, User, Notification, Acknowledgment&gt;)row.Tag;
            if (tup.Item1 == usr)
                sum += tup.Item4.Sum;

        }
        return sum;
    }
</code></pre>

<p>and</p>

<pre><code>    decimal GetAmount2(User usr)
    {
        decimal sum = 0;
        foreach (DataGridViewRow row in dgvRecords.Rows)
        {
            Tuple&lt;User, User, Notification, Acknowledgment&gt; tup = (Tuple&lt;User, User, Notification, Acknowledgment&gt;)row.Tag;
            if (tup.Item2 == usr)
                sum += tup.Item4.Sum;

        }
        return sum;
    }
</code></pre>

<p>The only difference in above codes are just a property. So is this available:</p>

<pre><code>    decimal GetAmount(User usr, Tuple&lt;User, User, Notification, Acknowledgment&gt;.Property Item)
    {
        decimal sum = 0;
        foreach (DataGridViewRow row in dgvRecords.Rows)
        {
            Tuple&lt;User, User, Notification, Acknowledgment&gt; tup = (Tuple&lt;User, User, Notification, Acknowledgment&gt;)row.Tag;
            if (tup.Item == usr)
                sum += tup.Item4.Sum;

        }
        return sum;
    }
</code></pre>

<p>And call :</p>

<pre><code>    { 
         GetAmount(usr, Tuple&lt;User, User, Notification, Acknowledgment&gt;.Item1)
         //and
         GetAmount(usr, Tuple&lt;User, User, Notification, Acknowledgment&gt;.Item2)   
    }
</code></pre>

<p>??</p>
