Skip to main content

Practice · 1 of 2

Reflection audit

CHALLENGE
Difficulty: advanced+25 XP

Given a type, list which reflection operations would break under aggressive trimming: implement static List<string> Audit(Type t) returning descriptions for each operation that survives trimming statically: include "gettype-of-t" if t is a compile-time visible type (always true here), "declared-fields" if it has fields (GetFields always works on kept types), "attribute-read" if it has attributes, "constructor-invoke" if it has a parameterless ctor — but NEVER include "scan-all-types" (never survives). The test verifies both the includes and the absent scan entry.

Back to lesson: Practice: Deployment drills