someDS.someDT.Where(x => x.Amount is not DBNull)
.Sum(x => x.Amount);
According to the link How to compare DBNull value, the above code should be fine or is there any other way to handle the above scenario?
someDS.someDT.Where(x => x.Amount is not DBNull)
.Sum(x => x.Amount);
According to the link How to compare DBNull value, the above code should be fine or is there any other way to handle the above scenario?
If your Amount is a nullable decimal then you can check null value of nullable decimal type as
someDS.someDT.Where(x => x.Amount.HasValue == true)
.Sum(x => x.Amount);
someDS.someDT.Where(x => x.Amount != DBNull.Value)
.Sum(x => x.Amount);