I have a large text file,over 6 million lines (A list of primes) and I am trying to import it into a array. Get-Content is way to slow so I have tried to use the DotNet to help out. This is what I have tried so far.
I did the same thing, Curtis, and got the same results you did. TeeStar, what do the contents of your file look like? Can you show us maybe the first 10 lines or so? You might open your .cfg file in something like notepad++ and see if there are any special characters that could be causing issues.
There must be \r on each line of .cfg file you are trying to read.
I’m very new to Powershell myself but it would happen in Python.
Try to strip any \r and \n character.