public static BinaryRule[][][] CloneRules(BinaryRule[][][] rules) { if (rules == null) { return null; } return rules.Select( x => x == null ? null : x.Select( y => y == null ? null : y.Select( z => z == null ? null : z.Clone() ).ToArray() ).ToArray() ).ToArray(); }