I am a little novice programmer. What I'm trying to do here is to check if there is a time, if it is selected, and if this time is equivalent to another. If this is all true, I want to skip the code block below it. Here is a sample code:
if (currentGVR.Round_Start_Time)
{
if (tr.StartLunchDateTime != null && currentGVR.Round_Start_Lunch && roundedStart == roundedStartL)
else
{
key = tr.TransactionID;
TransactionRecords[key]["Start_DateTime"] = roundedStart;
}
}
I was thinking about using the OR operator, but I can see where the error occurred if there was no time to compare. Using the AND operator avoids this dilemma.
Thus, the general question is whether coding correctly cancels all conditions in order to get the correct result, for example. if (! (cond)), and also, would this be the best way to check if there is a value to compare before actually comparing it in C # and otherwise? In some entries, the time may be zero (or not exist). Any recommendations?
Mark source
share