Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String pairs (multidimensional array?) C#

I basically want to keep a track of old filenames and each file's new filename.

I could use a Dictionary I suppose, but I want to keep it really lightweight.

Would a multidimensional string array work just as well?

like image 289
adamwtiko Avatar asked Nov 22 '25 09:11

adamwtiko


1 Answers

Use the Dictionary<string,string> class:

  1. It manages its own size for you
  2. It uses hashes to speed up searching for elements
  3. You can just go fileNames[oldName] to get the name instead of using a loop or LINQ

Really, the Dictionary is the lightweight solution here.

like image 98
Mike Caron Avatar answered Nov 24 '25 23:11

Mike Caron