I found a code example online that purports to count the number of pages in a PDF file. However, I’m getting the error ‘ToArray is not a member of ‘String’ on the following line:
Dim pdfMagicNumber() As Char = "0000".ToArray
I’m running VS 2010 on a Framework 2.0 project, on a machine running Windows 7 and IIS 7. I found one article that talked about IIS configuration as the culprit for this error, but my settings seem to be consistent with what they recommended.
Any ideas on this error?
Thanks!
Mike
ToArrayis an extension method introduced in .NET 3.5 onIEnumerable<T>. It works in .NET 3.5+ when called onstring, asstringimplementsIEnumerable<char>.However,
string.ToCharArray()is available in all versions of .NET, and even when you’re using .NET 3.5+, it will be more efficient thanToArray.In other words, you want: