コード例 #1
0
        private bool FieldsAreFilled(CardContent cardToCheck)
        {
            var type    = cardToCheck.GetType();
            var counter = 0;

            foreach (var property in type.GetProperties())
            {
                if (property.GetValue(cardToCheck) == null)
                {
                    counter++;
                }
            }

            if (counter == type.GetProperties().Length)
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
        private bool FieldsAreFilled(CardContent cardToCheck)
        {
            var type    = cardToCheck.GetType();
            var counter = 0;

            foreach (var property in type.GetProperties())
            {
                if (string.IsNullOrWhiteSpace((string)property.GetValue(cardToCheck).ToString()) ||
                    string.IsNullOrEmpty((string)property.GetValue(cardToCheck).ToString()))
                {
                    counter++;
                }
            }

            if (counter == type.GetProperties().Length)
            {
                return(false);
            }

            return(true);
        }