コード例 #1
0
ファイル: Program.cs プロジェクト: SngRIA/Navicon-Tasks
        public static bool ValidateMiddleName(Contact contact)
        {
            Type type       = typeof(Contact);
            var  middleName = type.GetProperty("MiddleName");

            StringLengthLimitAttribute middleNameLimit = (StringLengthLimitAttribute)middleName.GetCustomAttribute(typeof(StringLengthLimitAttribute));
            bool result = middleNameLimit.CheckLength(contact.MiddleName.Length);

            return(result);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: SngRIA/Navicon-Tasks
        public static bool ValidateLastName(Contact contact)
        {
            Type type     = typeof(Contact);
            var  lastName = type.GetProperty("LastName");

            StringLengthLimitAttribute lastNameLimit = (StringLengthLimitAttribute)lastName.GetCustomAttribute(typeof(StringLengthLimitAttribute));
            bool result = lastNameLimit.CheckLength(contact.LastName.Length);

            return(result);
        }