I need Method to print List as table in console application and preview in convenient format like this:
Pom_No Item_Code ordered_qty received_qty
1011 Item_Code1 ordered_qty1 received_qty1
1011 Item_Code2 ordered_qty2 received_qty2
1011 Item_Code3 ordered_qty3 received_qty3
1012 Item_Code1 ordered_qty1 received_qty1
1012 Item_Code2 ordered_qty2 received_qty2
1012 Item_Code3 ordered_qty3 received_qty3
Your main tool would be
The
,5and,10are width specifiers. Use a negative value to left-align.Formatting is also possible:
Or a Date with a width of 24 and custom formatting:
Edit, for C#6
With string interpolation you can now write
You don’t need to call
String.Format()explicitly anymore: