public string GetConstant(object constant) { if (constant is bool) { return((bool)constant == true ? "true" : "false"); } else if (constant is Enum) { Enum enumConst = (Enum)constant; return(enumConst.GetType().ToString() + "." + enumConst.ToString()); } else if (constant is IDictionary) { Type keyType; Type valueType; ContainerHelper.GetDictionaryTypes(constant, out keyType, out valueType); String srcType = "typeof(" + TypesHelper.PrefixedTypeFromType(keyType) + ")"; String dstType = "typeof(" + TypesHelper.PrefixedTypeFromType(valueType) + ")"; return("GRGEN_LIBGR.ContainerHelper.NewDictionary(" + srcType + "," + dstType + ")"); } else if (constant is IList) { Type valueType; ContainerHelper.GetListType(constant, out valueType); String dequeValueType = "typeof(" + TypesHelper.PrefixedTypeFromType(valueType) + ")"; return("GRGEN_LIBGR.ContainerHelper.NewList(" + dequeValueType + ")"); } else if (constant is IDeque) { Type valueType; ContainerHelper.GetDequeType(constant, out valueType); String dequeValueType = "typeof(" + TypesHelper.PrefixedTypeFromType(valueType) + ")"; return("GRGEN_LIBGR.ContainerHelper.NewDeque(" + dequeValueType + ")"); } else if (constant is string) { return("\"" + constant.ToString() + "\""); } else if (constant is float) { return(((float)constant).ToString(System.Globalization.CultureInfo.InvariantCulture) + "f"); } else if (constant is double) { return("((double)" + ((double)constant).ToString(System.Globalization.CultureInfo.InvariantCulture) + ")"); } else if (constant is sbyte) { return("((sbyte)" + constant.ToString() + ")"); } else if (constant is short) { return("((short)" + constant.ToString() + ")"); } else if (constant is long) { return("((long)" + constant.ToString() + ")"); } else if (constant is NodeType) { return("(GRGEN_LIBGR.TypesHelper.GetNodeType(\"" + constant + "\", graph.Model))"); } else if (constant is EdgeType) { return("(GRGEN_LIBGR.TypesHelper.GetEdgeType(\"" + constant + "\", graph.Model))"); } else { if (constant == null) { return("null"); } else { return(constant.ToString()); } } }