Convert Dictionary of any format to DataTable?

Hey guys,

I was just thinking to create a library module at my workplace which will take a Dictionary input and write to CSV file (2 columns: Key, Value)

I have everything working except I don’t know how to get around the fact that it could be a dictionary of any format (for example, a Dictionary(string,object) cannot be input). My argument type is Dictionary(string,string) but I want this to work with Dictionary of any format. How could I do this so that the Dictionary input is dynamic? I just want it to basically treat Key and Value as strings so it can be written to an output file.

Hi @Jon_G,

To be able to store different types of data in dictionary, kindly consider having a dictionary(string,object).

Using object type as value would allow to hold different types of data and while retrieving data , you can have those converters back to the format you want like string or int etc.

Regards
Sonali

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.