/// <summary> ///Method Name:SetDate /// Description://pass by reference in structure /// Author:bhumi /// Created On:25/5/2015 /// </summary> void SetDate(ref Str_Date s1) { s1.Dt = dt2; s1.mn = mn2; s1.yr = yr2; string input = s1.Dt + "-" + s1.mn + "-" + s1.yr; DateTime dateTime; if (DateTime.TryParse(input, out dateTime)) { } else { Console.WriteLine(objconst.strinvalid); // <-- Control flow goes here } }
/// <summary> ///Method Name:SetDate /// Description://pass by value in structure /// Author:bhumi /// Created On:25/5/2015 /// </summary> void SetDate(Str_Date s1) { try { s1.Dt = dt1; s1.mn = mn1; s1.yr = yr1; string input = s1.Dt + "/" + s1.mn + "/" + s1.yr; DateTime dateTime; if (DateTime.TryParse(input, out dateTime)) { } else { Console.WriteLine(objconst.strinvalid); // <-- Control flow goes here } } catch (Exception ex) { Console.WriteLine(ex.Message); } }