public List <SegmentErrorContext> Validate(InstanceContext instanceContext, int segmentIndex, int inSegmentIndex, int inComponentIndex, int repetitionIndex) { var result = new List <SegmentErrorContext>(); if (All_NM1_2 != null) { result.Add(new SegmentErrorContext("CustomValidationSegment", segmentIndex, instanceContext.GetType().GetTypeInfo(), SegmentErrorCode.LoopExceedsMaximumUse, "This is custom validation.")); } return(result); }