using "IS" is better or checking for "NOT NULL"
- by BDotA
In C#.NET language: This style of coding is recommended or the one below it?
if (sheet.Models.Data is GroupDataModel)
{
GroupDataModel gdm = (GroupDataModel)sheet.Models.Data;
Group group = gdm.GetGroup(sheet.ActiveCell.Row.Index);
if (group!=null && controller != null)
{
controller.CheckApplicationState();
}
}
or this one:
var gdm = sheet.Models.Data as GroupDataModel;
if (gdm != null)
{
Group group = gdm.GetGroup(sheet.ActiveCell.Row.Index);
if (@group!=null && controller != null)
{
controller.CheckApplicationState();
}
}