コード例 #1
0
        public static string FormatClrType(Type originalType)
        {
            var type = Nullable.GetUnderlyingType(originalType) ?? originalType;

            var shortName = TypeMapping.GetCSharpShortTypeName(type);

            if (shortName != null)
            {
                if (originalType != type)
                {
                    shortName += "?";
                }

                return(shortName);
            }

            if (type.Namespace == "System")
            {
                if (originalType != type)
                {
                    return(type.Name + "?");
                }
                else
                {
                    return(type.Name);
                }
            }

            return(type.ToString());
        }