InvalidType() public static method

public static InvalidType ( string typeName ) : Exception
typeName string
return System.Exception
Beispiel #1
0
        private Type GetDataType(ExpressionNode node)
        {
            Type   nodeType = node.GetType();
            string typeName = null;

            if (nodeType == typeof(NameNode))
            {
                typeName = ((NameNode)node)._name;
            }
            if (nodeType == typeof(ConstNode))
            {
                typeName = ((ConstNode)node)._val.ToString();
            }

            if (typeName == null)
            {
                throw ExprException.ArgumentType(s_funcs[_info]._name, 2, typeof(Type));
            }

            Type dataType = Type.GetType(typeName);

            if (dataType == null)
            {
                throw ExprException.InvalidType(typeName);
            }

            // ReadXml might not be on the current call stack. So we'll use the TypeLimiter
            // that was captured when this FunctionNode instance was created.

            TypeLimiter.EnsureTypeIsAllowed(dataType, _capturedLimiter);

            return(dataType);
        }
Beispiel #2
0
        private Type GetDataType(ExpressionNode node)
        {
            Type   nodeType = node.GetType();
            string typeName = null;

            if (nodeType == typeof(NameNode))
            {
                typeName = ((NameNode)node)._name;
            }
            if (nodeType == typeof(ConstNode))
            {
                typeName = ((ConstNode)node)._val.ToString();
            }

            if (typeName == null)
            {
                throw ExprException.ArgumentType(s_funcs[_info]._name, 2, typeof(Type));
            }

            Type dataType = Type.GetType(typeName);

            if (dataType == null)
            {
                throw ExprException.InvalidType(typeName);
            }

            return(dataType);
        }