Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

AutowireUtils.GetTypeDifferenceWeightOld Method

Determine a weight that represents the class hierarchy difference between types and arguments.

[Visual Basic]
Public Shared Sub GetTypeDifferenceWeightOld( _
   ByVal argTypes As ParameterInfo, _
   ByVal args As Object _
)
[C#]
public static int GetTypeDifferenceWeightOld(
   ParameterInfo[] argTypes,
   object[] args
);

Parameters

argTypes
The argument Types to match.
args
The arguments to match.

Return Value

The accumulated weight for all arguments.

Remarks

A direct match, i.e. type MyInteger -> arg of class MyInteger, does not increase the result - all direct matches means weight zero (0). A match between the argument type Object and a MyInteger instance argument would increase the weight by 1, due to the superclass (Object) being one (1) steps up in the class hierarchy being the last one that still matches the required type.

Therefore, with an argument of type Hashtable, a constructor taking a Hashtable argument would be preferred to a constructor taking an IDictionary argument which would be preferred to a constructor taking an ICollection argument which would in turn be preferred to a constructor taking an Object argument.

All argument weights get accumulated.

See Also

AutowireUtils Class | Spring.Objects.Factory.Support Namespace