나는 두 가지 질문이있다.foreach 루프
1) 나의 인터페이스는 IRegister라고 불리는 인터페이스를 가지고 있으며, IPerson이라는 또 다른 인터페이스를 가지고있다.
2) 두 개의 List (IRegister, IPerson)가 있는데 둘 다 하나 이상의 행을 가질 수 있습니다.
두 목록을 모두 루프하는 가장 좋은 방법은 무엇입니까? GetValidationRules 내에서?
public interface IRegister
{
string FirstName { get; }
string MiddleName { get; }
string LastName { get; }
string EmailAddress { get; }
List<IPerson> Student { get; }
}
public static List<ValidationRule> GetValidationRules(List<IRegister> register)
{
List<ValidationRule> validationRules = new List<ValidationRule>();
foreach (IRegister myregister in register)
{
if (string.IsNullOrEmpty(myregister.FirstName))
validationRules.Add(new ValidationRule("Reg", "Must have aFirst Name"));
if (string.IsNullOrEmpty(myregister.LastName))
validationRules.Add(new ValidationRule("Reg", "Must have a Last Name"));
if (string.IsNullOrEmpty(myregister.EmailAddress))
validationRules.Add(new ValidationRule("Reg", "Must have a Email Address"));
IPerson here? how
}
나는 C#에 대해 이야기하고있는 것으로 추측하고 있지만, 지정했다면 좋을 것입니다. – FrustratedWithFormsDesigner
plz에 질문하기 나는 많은 사람들이 이것을 얻게 될 것이라고 생각하지 않는다. – Midhat
이해하려는 노력 - 등록이되어 있고, 등록이 유효하다면, 사람을 만들고 싶습니까? –