Back to course

Introduction to Reflection

C# Zero to Hero: Comprehensive Programming Masterclass

What is Reflection?

Reflection allows you to inspect types (classes, methods, properties) at runtime.

Example

csharp Type t = typeof(string); Console.WriteLine($"Type name: {t.Name}");

Reflection is powerful but can be slow, so use it sparingly for things like plugins or custom serialization.