public void ClearValidation(string clearOptions = "") { if (clearOptions == "Xamarin.Forms.FocusEventArgs") { if (RefrenceTypeValidatables != null) { RefrenceTypeValidatables.Clear(); } if (ValueTypeValidatables != null) { ValueTypeValidatables.Clear(); } } else { (var clearOnlyValidation, var classPropertyNames) = clearOptions.ParseClearOptions(); if (RefrenceTypeValidatables != null) { RefrenceTypeValidatables.Clear(clearOnlyValidation, classPropertyNames); } if (ValueTypeValidatables != null) { ValueTypeValidatables.Clear(clearOnlyValidation, classPropertyNames); } } }
public void ClearValidation(string clearOptions = "") { // this may get you into trouble if you have exact same property name on your different classes - so should probably do a check up-front in reality or have separate methods (like the one below) // or better yet, limit your viewmodels to one class to validate... _beerValidatables.Clear(clearOptions); // could pass whatever you want as string and parse yourself.. // or could use the default already available, or call main Clear method directly... go wild var(clearOnlyValidation, classPropertyNames) = clearOptions.ParseClearOptions(); _emailValidatables.Clear(clearOnlyValidation, classPropertyNames); }