✅ write multiple Lists to file
I want to write several items from lists that have same index to text file, what is the easiest way
same index to text file
dynamicdynamic is what's weirdOrder class or whateverdynamic even as an example tells people it's fine to use itsame index to text fileOrderList<string> Data1 = new List<string>();
List<string> Data2 = new List<string>();
public void WriteLists(List<string>[] lists)
{
int index = 7; // some random index
foreach(List<string> data in lists)
{
if(data.Count >= index)
{
// write data to file
data[index];
}
}
}List<dynamic> Data1 = new List<dynamic>();
List<dynamic> Data2 = new List<dynamic>();
// using dynamic just bc i dont know datatypes
public void WriteLists(List<dynamic>[] lists)
{
int index = 0;
foreach(List<dynamic> data in lists)
{
WriteText(data[index]);
}
WriteText("\r\n");
}public class Ship
{
public string Name {get;set;}
public decimal Price {get;set;}
public int Quantity {get;set;}
public string Address {get;set;}
public string ShippingType {get;set;}
public string PayType {get;set;}
}class Shipping
{
public static List<Ship> Ships = new List<Ship>();
}