lundi 5 décembre 2016

If condition in c# with the same statement

I have this piece of code that checks for an object if is null or empty. What I want is if: condition a is true to do a+ and if condition a is true to do a+.

if (!string.IsNullOrEmpty(a) || string.IsNullOrEmpty(a))
                    {statement}

if (!string.IsNullOrEmpty(a) || string.IsNullOrEmpty(a)) {

                    if (table.a.HasValue || table.b.HasValue && 
                        ((DateTime?)GetResult(UploaddataBase.ProcessDateTime(a, i, null), "A").Value <= table.B.Value))
                    {
                        invalidRows.Add("A" + i.ToString(), string.Format("error message");
                    }
                    else
                    {
                        table.a= (DateTime?)GetResult(UploaddataBase.ProcessDateTime(a, i, null), "A").Value;
                        if (table.Rec.GetField(table.c_a).IsDirty)
                        {
                            table.AModifiedBy= modifiedBy;
                            part.AModifiedOn= modifiedOn;
                        }
                    }

                }

How can I rewrite this?

Aucun commentaire:

Enregistrer un commentaire