Quick Tip: Use System.IO.Path.Combine instead of string concatenation (mattberseth.com)

published 2 years, 7 months ago, submitted by mbersethmberseth(1375) 2 years, 8 months ago

System.IO.Path has a number of utility methods that are useful when you have to progamatically build a file path ...

2 comments | category: | Views: 88

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:

Comments:

posted by JustinFJustinF(0) 2 years, 7 months ago

Yep, System.IO.Path is the way to go. I see application errors just waiting to happen whenever I see paths being built in our applications without using the Combine() method.

posted by grauenwolfgrauenwolf(75) 2 years, 7 months ago

Just make sure you watch out for absolute paths in the second argument. I have seen security holes caused by people trying to use Path.Combine to keep users within a specific directory.

http://grauenwolf.spaces.live.com/blog/cns!410AE16A9B73776E!164.entry

information Login or create an account to comment on this story