FileInfo behaving strange
I'm running LINQPad version 7.0.17.
I'm getting this issue with FileInfo acting really strange:
where it finds System.IO.FileInfo
on line 17, but can't initialize it. Likewise, line 17 shows that it doesn't find it either. I've tried on line 17 putting the explicit reference of System.IO.FileInfo
and it does the same thing.
On the Query Properties, I have the correct namespace entered:
System System.Collections System.Collections.Generic System.Data System.Diagnostics System.IO System.Linq System.Linq.Expressions System.Reflection System.Text System.Text.RegularExpressions System.Threading System.Transactions System.Xml System.Xml.Linq System.Xml.XPath Microsoft.Data.Sqlite System.Xml.Serialization
File showing the problem is attached
Comments
remove the filename ending
Line 17
FileInfo fi2 = new();
There is no parameterless constructor for FileInfo so you need to add one, e.g. something like
FileInfo fi2 = new(file);
Line 18
var fi = FileInfo(file);
This is assuming you are calling a Method called FileInfo which does not exist.
This should be
var fi = new FileInfo(file);
Thanks @sgmoore ! Yep a coder problem not a LP problem.