Why does the .NET Framework provide both
System.Type.GenericTypeArguments
and
System.Type.GetGenericArguments()
which both return the type arguments (both as a Type[]
) of a given generic type ?
Seems the property and the method expose the very same functionality, meaning the API's interface has redundant/duplicate functionalities ?
GenericTypeArguments
property returns an empty array if the type is a generic type defintion, while theGetGenericArguments
method returns an array with the types for the generic arguments.GenericTypeArguments
property was added in framework 4.5.The
GenericTypeArguments
property is actually implemented to callGetGenericArguments
when the type is an implementation of a generic type:Source: http://referencesource.microsoft.com/#mscorlib/system/type.cs,0aa31a7de47b9dc7