Amazon.KinesisTap.Common/Guard.cs
/// <summary>
/// Verifies that an argument type is assignable from the provided type (meaning
/// interfaces are implemented, or classes exist in the base class hierarchy).
/// </summary>
/// <param name="assignmentTargetType">The argument type that will be assigned to.</param>
/// <param name="assignmentValueType">The type of the value being assigned.</param>
/// <param name="argumentName">Argument name.</param>
Verifies that an argument type is assignable from the provided type (meaning
interfaces are implemented, or classes exist in the base class hierarchy).
Verifies that an argument type is assignable from the provided type ( meaning interfaces are implemented or classes exist in the base class hierarchy ) .
public static void TypeIsAssignable(Type assignmentTargetType, Type assignmentValueType, string argumentName)
        {
            if (assignmentTargetType == null)
            {
                throw new ArgumentNullException("assignmentTargetType");
            }
            if (assignmentValueType == null)
            {
                throw new ArgumentNullException("assignmentValueType");
            }
            if (!assignmentTargetType.GetTypeInfo().IsAssignableFrom(assignmentValueType.GetTypeInfo()))
            {
                throw new ArgumentException(string.Format(
                    CultureInfo.CurrentCulture,
                    Resources.TypesAreNotAssignable,
                    assignmentTargetType,
                    assignmentValueType),
                    argumentName);
            }
        }
public static void TypeIsAssignable ( Type assignmentTargetType , Type assignmentValueType , string argumentName ) { if ( assignmentTargetType == null ) { throw new ArgumentNullException ( " " ) ; } if ( assignmentValueType == null ) { throw new ArgumentNullException ( " " ) ; } if ( ! assignmentTargetType . GetTypeInfo ( ) . IsAssignableFrom ( assignmentValueType . GetTypeInfo ( ) ) ) { throw new ArgumentException ( string . Format ( CultureInfo . CurrentCulture , Resources . TypesAreNotAssignable , assignmentTargetType , assignmentValueType ) , argumentName ) ; } }
Verifies that an argument type is assignable from the provided type (meaning
interfaces are implemented, or classes exist in the base class hierarchy).
Verifies that an argument type is assignable from the provided type ( meaning interfaces are implemented or classes exist in the base class hierarchy ) .
assignmentTargetType
Type
The argument type that will be assigned to.
The argument type that will be assigned to .
assignmentValueType
Type
The type of the value being assigned.
The type of the value being assigned .
argumentName
string
None