public static void ForEachContextsWithManner <T>(this IDictContext context, string mannerKey, Action <T> callback)
     where T : Manner
 {
     TreeHelper.ForEachDescendants <IContext>(context, (IContext element) => {
         T manner = element.Manners.Get <T>(mannerKey, false);
         if (manner != null)
         {
             callback(manner);
         }
     });
 }
Exemple #2
0
        public static void ForEachAspects <T>(this IAspect aspect, Action <T> callback)
            where T : class, IAspect
        {
            T asT = aspect as T;

            if (asT != null)
            {
                callback(asT);
            }
            IDict asDict = aspect as IDict;

            if (asDict != null)
            {
                TreeHelper.ForEachDescendants <T>(asDict, callback);
            }
            ITable asTable = aspect as ITable;

            if (asTable != null)
            {
                TreeHelper.ForEachDescendants <T>(asTable, callback);
            }
        }
 public static void ForEachContexts <T>(this IDictContext context, Action <T> callback)
     where T : class, IContext
 {
     TreeHelper.ForEachDescendants <T>(context, callback);
 }