3
I am a beginner in c# and right now I have some doubts about how to pass the structure of a datatable for a class to later use it, this to avoid duplicate code since I have several tables that use the same structure depending on the type (condition that has to be used A or B). and was trying to pass these structures to a class in which there would be a class that contains Structure for Type A ( datable structure and datarows) and B the same thing. I just don’t know how to pass one datatable for a class and then call in the main.
How can I pass this logic (Table structure ) to a class and call it in the main?
Datatable structure (example) :
nomeTabela.columns.add("...")
(...)
DataRow drinfo = dataTableInfo.NewRow();
  drinfo ["col1"] = var1;
  drinfo ["col2"] = var2;
  drinfo ["col3"] = var3; 
  drinfo ["col4"] = var4;
  drinfo ["col5"] = var5;
  drinfo ["col6"] = var6;
(...)
 datatableX.Rows.Add(drinfo );
Do not use Datatable, search by
repository patternand be happy– Rovann Linhalis