Reputation: 7240
I have a DataGridView that is bound to a BindingList of objects and I need to access the value of a particular cell in each row as quickly as possible. Is it faster to do:
if (((ObjectType)row.DataBoundItem).StringProperty != string.Empty)
{
}
...or...
if (row.Cells["STRINGPROPERTY"].Value != string.Empty)
{
}
Or is there another way that's faster than both of these?
Upvotes: 0
Views: 419
Reputation: 7082
There's a lot of way to check the value with if is empty or null but from your main question you can go and try to Benchmarking method calls in C#
Upvotes: 1