Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a simple question that I can't find a answer to:

With the .NET Framework what is the difference in saying "folder1/folder2/file" and "folder1\\folder2\\file" in a file directory? Is there even a difference?

Also what does the "@" character do? I'm not sure if this is XNA specific or .NET specific but here is an example: ContentManager.Load<Texture2D>(@"SpriteSheets/Tile");

Thanks.

share|improve this question
3  
AFAIk, @"S:\ome\path\file.ext" will turn the string into "S:\\ome\\path\\file.ext" for you, so you don't have to escape it yourself. –  melak47 Sep 16 '12 at 3:31
add comment

1 Answer

up vote 4 down vote accepted

Here is a resource on what @""-style string literals are.

Basically they turn off escaping. So, for example, you only need @"\", instead of "\\" to get the \ character.

Another example: @"\t" gives you \t, whereas "\t" (no at symbol) gives you a tab character.


Internally XNA handles the difference between path separator characters. You can use \ or / (or some crazy combination of both) and it won't matter.

(I'm pretty sure Windows itself doesn't care which character you use either.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.