Как я могу перебирать все System.Data.SqlDbType?

JRExporterParameter устарел в последних версиях, это не устаревшее решение @stevemac answer

JRPdfExporter exporter = new JRPdfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outputStream));
SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
configuration.setMetadataAuthor("Petter");  //why not set some config as we like
exporter.setConfiguration(configuration);
exporter.exportReport();
0
задан David Walser 13 July 2018 в 06:49
поделиться

1 ответ

Вы можете попробовать следующее:

foreach (SqlDbType type in Enum.GetValues(typeof(SqlDbType)))
{
   ..code
}
5
ответ дан vasily.sib 17 August 2018 в 13:31
поделиться
  • 1
    Можно ли сразу их сохранить в список? Например, public readonly List<SqlDbType> Types = new List<SqlDbType>(Enum.GetValues(typeof(SqlDbType))); – David Walser 13 July 2018 в 07:03
  • 2
    конечно, но вам нужно бросить его сначала, например: Enum.GetValues(typeof(SqlDbType)).Cast<SqlDbType>().ToList() – vasily.sib 13 July 2018 в 07:06
  • 3
    спасибо большое, извините, я не знал .Cast<Type>(): D – David Walser 13 July 2018 в 07:07
Другие вопросы по тегам:

Похожие вопросы: