示例#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));
        }