I'm quite new to C#, so I got a task to allign words in columns.
So basically I've got a notepad with text in it for example:
wordone word two... wordmillion
word one word two word three
wordjosdjfjfisio anotherword otherword
It looks like you are on the right track here!
First of all, here is the documentation for PadRight:https://msdn.microsoft.com/en-us/library/36f2hz3a%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396.
Taken from this MSDN explanation, we can see the following useful example:
string str = "forty-two"; char pad = '.'; Console.WriteLine(str.PadRight(15, pad)); // Displays "forty-two......". Console.WriteLine(str.PadRight(2, pad)); // Displays "forty-two".
So a psuedo code algorithm for your answer could be the following - let me know if you need more explanation:
Note - MaxLength + 1 is just so a space will be shown after your longest word as well. I hope this is enough info to get you on your way. Feel free to ask any follow up questions!