What is the primary purpose of delegates in C#?
- Data storage
- String manipulation
- Memory allocation
- Type-safe function pointers
Explanation
Delegates are type-safe function pointers that can hold references to both static and instance methods. They enable callbacks, event handling, and functional programming patterns.