DynamicReflectionManager.ConvertValueTypeArgumentIfNecessary Method
Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

DynamicReflectionManager.ConvertValueTypeArgumentIfNecessary Method

Converts value to an instance of targetType if necessary to e.g. avoid e.g. double/int cast exceptions.

[Visual Basic]
Public Shared Sub ConvertValueTypeArgumentIfNecessary( _
   ByVal value As Object, _
   ByVal targetType As Type, _
   ByVal argIndex As Integer _
public static object ConvertValueTypeArgumentIfNecessary(
   object value,
   Type targetType,
   int argIndex


This method mimics the behavior of the compiler that automatically performs casts like int to double in "Math.Sqrt(4)".
See about implicit, widening type conversions on MSDN - Type Conversion Tables

Note: targetType is expected to be a value type!

See Also

DynamicReflectionManager Class | Spring.Reflection.Dynamic Namespace