Example #1
0
 private static void _ValidateAnnotations(Annotation[] annotations, AnnotationTypes type)
 {
     if (annotations == null || annotations.Length == 0)
     {
         return;
     }
     foreach (var annotation in annotations)
     {
         if (annotation == null)
         {
             continue;
         }
         var decl = annotation.Declaration as CapnpAnnotation;
         if (decl == null)
         {
             decl = (CapnpAnnotation)((CapnpBoundGenericType)annotation.Declaration).OpenType;
         }
         if (!decl.Targets.Any(t => t == AnnotationTypes.any || t == type))
         {
             throw new Exception("invalid annotation, cannot be applied to this declaration");
         }
     }
 }
 private static void _ValidateAnnotations(Annotation[] annotations, AnnotationTypes type)
 {
     if (annotations == null || annotations.Length == 0) return;
      foreach (var annotation in annotations)
      {
     if (annotation == null) continue;
     var decl = annotation.Declaration as CapnpAnnotation;
     if (decl == null) decl = (CapnpAnnotation)((CapnpBoundGenericType)annotation.Declaration).OpenType;
     if (!decl.Targets.Any(t => t == AnnotationTypes.any || t == type))
        throw new Exception("invalid annotation, cannot be applied to this declaration");
      }
 }