Have you considered using a switch statement?
On Wed, Oct 27, 2010 at 11:59 AM, Arjang Assadi <[email protected]>wrote:
> I need to do something similar to do this :
>
> if (e.Value is Book)
> {
> e.Value = (e.Value as X).Title;
>
> }
> else if (e.Value is Customer)
> {
> e.Value = (e.Value as Customer).FullName;
> }
> else
> {
> e.Value = "Unknown";
> }
> etc.
>
> in DataGridView_CellFormatting even, but it just looks plain ugly. is
> there way to do this in a more structured manner?
>
> Regards
>
> Arjang
>