Here i want to check all properties of object one by one and check if it's not NAN than apply some logic else skip for each properties.
for that i have to make multiple ifs. is there better way i should do it?
internal class cls_pro
{
public double A;
public double B;
public double C;
public double D;
public double E;
public double F;
}
class Program
{
static void Main(string[] args)
{
cls_pro obj = new cls_pro();
obj.A = 1;
obj.B = 3;
obj.C = 1;
obj.D = 23;
obj.E = double.NaN;
obj.F = double.NaN;
// If propertie is not null some logic will apply
if (!double.IsNaN(obj.A)) { ;}
if (!double.IsNaN(obj.B)) { ;}
if (!double.IsNaN(obj.C)) { ;}
if (!double.IsNaN(obj.D)) { ;}
if (!double.IsNaN(obj.E)) { ;}
if (!double.IsNaN(obj.F)) { ;}
Console.ReadLine();
}
}
Aucun commentaire:
Enregistrer un commentaire