Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. FileInfo.ValidateFIleName

FileInfo.ValidateFIleName

Scheduled Pinned Locked Moved C#
csharpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    elena12345
    wrote on last edited by
    #1

    Is there a way to validate a file name in C#? I know I could easily code this up myself, but this is something everyone always needs, so I am in total denial that there is no function like that in C# libraries. :omg: Thanks, Elena

    N J 2 Replies Last reply
    0
    • E elena12345

      Is there a way to validate a file name in C#? I know I could easily code this up myself, but this is something everyone always needs, so I am in total denial that there is no function like that in C# libraries. :omg: Thanks, Elena

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      What do you mean validate a file name? Validate how? That it matches some naming scheme, is a certain length? Then the answer is no.

      1 Reply Last reply
      0
      • E elena12345

        Is there a way to validate a file name in C#? I know I could easily code this up myself, but this is something everyone always needs, so I am in total denial that there is no function like that in C# libraries. :omg: Thanks, Elena

        J Offline
        J Offline
        John Kuhn
        wrote on last edited by
        #3

        Try creating a file using an invalid file name and see if an exception happens, and handle the exception.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups