Call for quick method is:
QuickMethods.IsFullyEmpty(CompanyName.Text) ||
QuickMethods.IsFullyEmpty(UsernameText.Text) ||
QuickMethods.IsFullyEmpty(PasswordText.Password)
and implementation is:
public static class QuickMethods
{
public static bool IsFullyEmpty(string s)
{
if (string.IsNullOrEmpty(s.Trim()))
return true;
return false;
}
}
is there any option available? if yes then how?
The main benefit is encapsulating the implementation of IsFullyEmpty. This improves your design as you are only need to change the implementation of IsFullyEmpty in one component (instead of every component that calls IsFullyEmpty). As you (or other team members) develop new components, you can avoid bugs down the road that were a result of re-implementing the IsFullyEmpty() logic (ie, the new programmer on your team may forget to Trim() the string first). There are refactoring benefits as well, for example, if this was a .NET 2.0 project that moved to .NET 4.0, you could refactor IsFullyEmpty to: