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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. print string path of current C# document

print string path of current C# document

Scheduled Pinned Locked Moved C#
questioncsharptutorial
4 Posts 2 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
    edel_ong
    wrote on last edited by
    #1

    How can I print the string path of the C# document I am currently using? Like for example, I am programming sample.cs , is there a line of code i can insert into sample.cs that can print it's location? Thanks a lot!

    G 1 Reply Last reply
    0
    • E edel_ong

      How can I print the string path of the C# document I am currently using? Like for example, I am programming sample.cs , is there a line of code i can insert into sample.cs that can print it's location? Thanks a lot!

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      No, you can't, as you are not executing the sample.cs file. You are executing the exe or dll file that is created from the code. --- b { font-weight: normal; }

      E 1 Reply Last reply
      0
      • G Guffa

        No, you can't, as you are not executing the sample.cs file. You are executing the exe or dll file that is created from the code. --- b { font-weight: normal; }

        E Offline
        E Offline
        edel_ong
        wrote on last edited by
        #3

        How about trying to access picture files without straight forward giving the directory of the picture folder? I tried asking the same question before and it worked for a while... After some time, the code did not work anymore and I don't know why. The following was the code: String fileOfPic = "...//...//folder1//folder2"; Now it does not work anymore... and I don't know why.. :(

        G 1 Reply Last reply
        0
        • E edel_ong

          How about trying to access picture files without straight forward giving the directory of the picture folder? I tried asking the same question before and it worked for a while... After some time, the code did not work anymore and I don't know why. The following was the code: String fileOfPic = "...//...//folder1//folder2"; Now it does not work anymore... and I don't know why.. :(

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          You have to have some kind of fixed location relative to the image folder that you can use to determine where it is. What is it that you are developing? A program? A web application? Where is the image folder located? --- b { font-weight: normal; }

          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