public PresidentStateFilter(string state)
 {
     _state = new Name(state);
 }
Exemple #2
0
 public PersonFullName(Name surname, params Name[] givenNames)
 {
     Surname = surname;
     GivenNames = givenNames;
 }
Exemple #3
0
        private static void DoParse(string value, out PersonFullName result, out System.Exception exception)
        {
            if (string.IsNullOrWhiteSpace(value)) {
                result = null;
                exception = new FormatException("Value is null, empty or whitespace.");
                return;
            }

            string[] parts = value.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries);

            if (parts.Length < 2) {
                result = null;
                exception = new FormatException("Full name shall have at least 2 names.");
                return;
            }

            var surname = new Name(parts.Last());
            IEnumerable<Name> givenNames = parts.Take(parts.Length - 1).Select(name => new Name(name));
            result = new PersonFullName(surname, givenNames.ToArray());
            exception = null;
        }
Exemple #4
0
 private bool Equals(Name other)
 {
     return string.Equals(_name, other._name, StringComparison.OrdinalIgnoreCase);
 }