Reputation: 477
I have the following class:
class Channel
{
public int Number { get; private set; }
public double HighestCoChannelSignal { get; private set; }
public double HighestOverlappingSignal { get; private set; }
public List<Network> NetsCoChannel { get; set; }
public List<Network> NetsOverlapping { get; set; }
}
I have a list of Channel objects. I want to bind it to a DataGridView and show: Number, HighestCoChannelSignal, HighestOverlappingSignal, NetsCoChannel.Count, NetsOverlapping.Count. And for example if the HighestCoChannelSignal is a special value set the cell value in DataGridView to something I want. How can I achieve this?
Upvotes: 1
Views: 84
Reputation: 54417
You can perform a LINQ query to get the data you want into instances of an anonymous type and bind the result to the grid, e.g.
var data = channels.Select(c => new {c.Number,
c.HighestCoChannelSignal,
c.HighestOverlappingSignal,
NetsCoChannelCount = c.NetsCoChannel.Count,
NetsOverlappingCount = c.NetsOverlapping.Count})
.ToArray();
You can add whatever code is appropriate to deal with that "special value". If you want a specific answer then you'll have to provide a specific description.
Upvotes: 1