Created
January 22, 2014 01:45
-
-
Save mgroves/8552108 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // which is the better design, given StateArgs? A or B? | |
| public class StateArgs | |
| { | |
| public bool IsValid { get; set; } | |
| public string Value { get; set; } | |
| } | |
| // A | |
| public static void ValidateState(StateArgs args) | |
| { | |
| if(string.IsNullOrEmpty(args.Value)) | |
| return; | |
| args.IsValid = Dictionary.Contains(args.Value); | |
| } | |
| // B | |
| public static void ValidateState(StateArgs args) | |
| { | |
| if(string.IsNullOrEmpty(args.Value)) | |
| args.IsValid = false; | |
| else | |
| args.IsValid = Dictionary.Contains(args.Value); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment