public string ConvertTypeToString(Type type, ProryvReportLanguageType language) { string typeStr = ConvertTypeToStringEx(type, language); if (string.IsNullOrEmpty(typeStr)) { return(type.ToString()); } return(typeStr); }
public string GetFunctionString(ProryvReportLanguageType language, bool addFunctionName) { StringBuilder sb = new StringBuilder(); if (addFunctionName) { sb.Append(this.FunctionName); } sb.Append(" ("); int index = 0; if (ArgumentTypes != null) { foreach (Type argumentType in this.ArgumentTypes) { string argumentName = this.ArgumentNames[index]; if (argumentType.IsArray) { sb.Append(argumentName); } else { sb.Append(ConvertTypeToString(argumentType, language)); } index++; if (index != this.ArgumentTypes.Length) { sb.Append(", "); } } } sb.Append(")"); if (this.ReturnType != typeof(void)) { sb.Append(" : " + ConvertTypeToString(this.ReturnType, language)); } return(sb.ToString()); }
public static string ConvertTypeToStringEx(Type type, ProryvReportLanguageType language) { if (language == ProryvReportLanguageType.CSharp) { if (type == typeof(int)) { return("int"); } if (type == typeof(uint)) { return("uint"); } if (type == typeof(long)) { return("long"); } if (type == typeof(ulong)) { return("ulong"); } if (type == typeof(string)) { return("string"); } if (type == typeof(bool)) { return("bool"); } if (type == typeof(object)) { return("object"); } if (type == typeof(void)) { return("void"); } if (type == typeof(byte)) { return("byte"); } if (type == typeof(sbyte)) { return("sbyte"); } if (type == typeof(short)) { return("short"); } if (type == typeof(ushort)) { return("ushort"); } if (type == typeof(char)) { return("char"); } if (type == typeof(double)) { return("double"); } if (type == typeof(float)) { return("float"); } if (type == typeof(decimal)) { return("decimal"); } if (type == typeof(DateTime)) { return("DateTime"); } if (type == typeof(TimeSpan)) { return("TimeSpan"); } if (type == typeof(byte?)) { return("byte?"); } if (type == typeof(sbyte?)) { return("sbyte?"); } if (type == typeof(bool?)) { return("bool?"); } if (type == typeof(byte?)) { return("char?"); } if (type == typeof(short?)) { return("short?"); } if (type == typeof(ushort?)) { return("ushort?"); } if (type == typeof(int?)) { return("int?"); } if (type == typeof(uint?)) { return("uint?"); } if (type == typeof(long?)) { return("long?"); } if (type == typeof(ulong?)) { return("ulong?"); } if (type == typeof(double?)) { return("double?"); } if (type == typeof(float?)) { return("float?"); } if (type == typeof(decimal?)) { return("decimal?"); } if (type == typeof(DateTime?)) { return("DateTime?"); } if (type == typeof(TimeSpan?)) { return("TimeSpan?"); } if (type == typeof(Guid?)) { return("Guid?"); } if (type == null) { return(null); } if (Nullable.GetUnderlyingType(type) != null) { return(string.Format("{0}?", Nullable.GetUnderlyingType(type))); } if (type.IsGenericType) { return("Object"); } } else { if (type == typeof(int)) { return("Integer"); } if (type == typeof(long)) { return("Long"); } if (type == typeof(string)) { return("String"); } if (type == typeof(bool)) { return("Boolean"); } if (type == typeof(object)) { return("Object"); } if (type == typeof(void)) { return("Void"); } if (type == typeof(byte)) { return("Byte"); } if (type == typeof(short)) { return("Short"); } if (type == typeof(char)) { return("Char"); } if (type == typeof(double)) { return("Double"); } if (type == typeof(float)) { return("Single"); } if (type == typeof(decimal)) { return("Decimal"); } if (type == typeof(DateTime)) { return("DateTime"); } if (type == typeof(byte?)) { return("Nullable(Of Byte)"); } if (type == typeof(bool?)) { return("Nullable(Of Boolean)"); } if (type == typeof(byte?)) { return("Nullable(Of Char)"); } if (type == typeof(short?)) { return("Nullable(Of Short)"); } if (type == typeof(int?)) { return("Nullable(Of Integer)"); } if (type == typeof(long?)) { return("Nullable(Of Long)"); } if (type == typeof(double?)) { return("Nullable(Of Double)"); } if (type == typeof(float?)) { return("Nullable(Of Single)"); } if (type == typeof(decimal?)) { return("Nullable(Of Decimal)"); } if (type == typeof(DateTime?)) { return("Nullable(Of DateTime)"); } if (type == typeof(TimeSpan?)) { return("Nullable(Of TimeSpan)"); } if (type == typeof(Guid?)) { return("Nullable(Of Guid)"); } if (Nullable.GetUnderlyingType(type) != null) { return(string.Format("Nullable(Of {0})", Nullable.GetUnderlyingType(type))); } if (type.IsGenericType) { return("Object"); } } return(null); }
public string GetFunctionString(ProryvReportLanguageType language) { return(GetFunctionString(language, true)); }