예제 #1
0
 public PresidentStateFilter(string state)
 {
     _state = new Name(state);
 }
예제 #2
0
 public PersonFullName(Name surname, params Name[] givenNames)
 {
     Surname = surname;
     GivenNames = givenNames;
 }
예제 #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;
        }
예제 #4
0
파일: Name.cs 프로젝트: rgavrilov/Sogeti
 private bool Equals(Name other)
 {
     return string.Equals(_name, other._name, StringComparison.OrdinalIgnoreCase);
 }