How can i iterate case insensitive

i am iterating some file extension like pdf format using

Directory.GetFiles(path,"*.pdf")

but i want if my condition is
.PDF",
"
.Pdf”,
“*.pDF”

etc.
then how i will iterate.

Hi,
Please try the below code
Directory.GetFiles(Path.ToString, “ .PDF”).Concat(Directory.GetFiles(Path.ToString, “ .pdf”).Concat(Directory.GetFiles(Path.ToString, “* .pDF”))

The search pattern is not case-sensitive.
So the return list contains the files that ends with .pdf OR .PDF OR .Pdf etc.,

Regards,
Karthik Byggari

4 Likes