Catel.Fody.CecilExtensions.IsBoxingRequired C# (CSharp) Method

IsBoxingRequired() public static method

public static IsBoxingRequired ( this typeReference, TypeReference expectedType ) : bool
typeReference this
expectedType Mono.Cecil.TypeReference
return bool
        public static bool IsBoxingRequired(this TypeReference typeReference, TypeReference expectedType)
        {
            if (expectedType.IsValueType && string.Equals(typeReference.FullName, expectedType.FullName))
            {
                // Boxing is never required if type is expected
                return false;
            }

            if (typeReference.IsValueType || typeReference.IsGenericParameter)
            {
                return true;
            }

            return false;
        }