Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[idea] Fluent Is-Style API Design #27

Open
szabototo89 opened this issue Oct 7, 2014 · 0 comments
Open

[idea] Fluent Is-Style API Design #27

szabototo89 opened this issue Oct 7, 2014 · 0 comments

Comments

@szabototo89
Copy link
Owner

I should implement Helpers method as fluent style:

bool isUpperCase = "Hello World".Is.UpperCase;
bool isBlank = "Hello".Is.Blank;
bool isNotNull = "Hi".Is.Not.Null;

public class Utility<T> {
   public String Value { get; protected set; }
   public Utility(T value) { Value = value; }
}

public class StringUtility : Utility<String> { }

public static class StringHelper {
   public static StringUtility<String> Is(this String that) {
      return new StringUtility(that);
   }
}

Advantages:

  • Easy to extend with new functionality
  • Easy to read, maintain and refactor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant