Skip to content

Instantly share code, notes, and snippets.

@grumpydev
Created January 24, 2018 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grumpydev/7a7c776ea506c790cf09eb4d93718ac9 to your computer and use it in GitHub Desktop.
Save grumpydev/7a7c776ea506c790cf09eb4d93718ac9 to your computer and use it in GitHub Desktop.
class Program
{
public class TimeTargetCategory
{
public Guid Id { get; set; }
public Guid TimeTargetId { get; set; }
public Guid CategoryId { get; set; }
public decimal? MondayTarget { get; set; }
public decimal? TuesdayTarget { get; set; }
public decimal? WednesdayTarget { get; set; }
public decimal? ThursdayTarget { get; set; }
public decimal? FridayTarget { get; set; }
public decimal? SaturdayTarget { get; set; }
public decimal? SundayTarget { get; set; }
}
static void Main(string[] args)
{
var timeTargetCategory = new TimeTargetCategory
{
MondayTarget = 6,
TuesdayTarget = 6,
WednesdayTarget = 6,
ThursdayTarget = 6,
FridayTarget = 6,
SaturdayTarget = 6,
SundayTarget = 6
};
var result = timeTargetCategory.MondayTarget ?? 0 +
timeTargetCategory.TuesdayTarget ?? 0 +
timeTargetCategory.WednesdayTarget ?? 0 +
timeTargetCategory.ThursdayTarget ?? 0 +
timeTargetCategory.FridayTarget ?? 0 +
timeTargetCategory.SaturdayTarget ?? 0 +
timeTargetCategory.SundayTarget ?? 0;
Console.WriteLine("Result: {0}", result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment