Is there any reason why .NET's Reflection API uses arrays instead of indexers to access a type's members/methods/properties/etc.? I understand the overhead of adding collection objects classes such as MemberInfoCollection
, MethodInfoCollection
, etc. However, these collection objects classes could be created instantiated on demand. Was the design rationale something other than just "dissuade programmers from using Reflection unless they really need it"?
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- C# how to invoke a field initializer using reflect
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
These APIs were created in .Net 1.0, which didn't have generics.
They couldn't just return a
ReadOnlyCollection<MemberInfo>
, and they were too lazy to create a separate typed collection class for each type they need to return.(I don't have a source for this belief)