示例#1
0
        /// <summary>
        /// Convert a type from the debugger's type system into X# type system
        /// </summary>
        /// <param name="lmrType">LMR Type</param>
        /// <returns>X# type</returns>
        public static XSharpType GetXSharpTypeForLmrType(Type lmrType)
        {
            if (lmrType.IsPrimitive)
            {
                return(XSharpType.Create(lmrType.FullName));
            }
            else if (lmrType.IsArray)
            {
                XSharpType elementType = GetXSharpTypeForLmrType(lmrType.GetElementType());

                return(elementType.MakeArrayType());
            }
            else if (lmrType.IsByRef)
            {
                XSharpType elementType = GetXSharpTypeForLmrType(lmrType.GetElementType());

                return(elementType.MakeByRefType());
            }
            else if (lmrType.FullName.Equals("System.String"))
            {
                return(XSharpType.String);
            }

            // Unknown
            return(XSharpType.Create(lmrType.FullName));
        }
示例#2
0
        /// <summary>
        /// Convert a type from the debugger's type system into X# type system
        /// </summary>
        /// <param name="lmrType">LMR Type</param>
        /// <returns>X# type</returns>
        public static XSharpType GetXSharpTypeForLmrType(Type lmrType)
        {
            if (lmrType.IsPrimitive)
            {
                return(XSharpType.Create(lmrType.FullName));
            }
            else if (lmrType.IsArray)
            {
                XSharpType elementType = GetXSharpTypeForLmrType(lmrType.GetElementType());

                return(elementType.MakeArrayType());
            }
            else if (lmrType.IsByRef)
            {
                XSharpType elementType = GetXSharpTypeForLmrType(lmrType.GetElementType());

                return(elementType.MakeByRefType());
            }
            else if (lmrType.IsGenericType)
            {
                var args = lmrType.GetGenericArguments();
                var td   = lmrType.GetGenericTypeDefinition();
                return(XSharpType.Create(td, args));
            }

            else if (lmrType.FullName.Equals("System.String"))
            {
                return(XSharpType.String);
            }

            // Unknown
            return(XSharpType.Create(lmrType.FullName));
        }
示例#3
0
        public XSharpType ConvertToXSharpType()
        {
            switch (FullName)
            {
            case "System.Boolean":
                return(XSharpType.Logic);

            case "System.Int32":
                return(XSharpType.Integer);

            case "System.String":
                return(XSharpType.String);

            case "System.Void":
                return(XSharpType.Void);

            default:
                return(XSharpType.Create(FullName));
            }
        }