Skip to content
Advertisement

Convert Data Rows into string array c#

I want to convert my data table rows data into string array, plse guide my….. i tried this but its showing nullException

Advertisement

Answer

this code maybe help you(this is example)

List<string> dt = new List<string>() { "2032","626362563","tp 150","tp 175"}; // equil your dt 
List<string> models = new List<string>();

for (int i = 0; i < dt.Count(); i++)
      models.Add(dt[i]);

foreach (var model in models)            
      Console.WriteLine(model);

Result : enter image description here

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement