Click here to Skip to main content
15,900,110 members
Please Sign up or sign in to vote.
1.19/5 (7 votes)
See more:
VB
string localFilenamePath = My.Computer.FileSystem.SpecialDirectories.Temp + "/" + filename;


What is the Replacement of Above Code in C# Language?

Thanks
Posted
Updated 28-Mar-17 4:24am

Hi,

Please use following code to get temporary folder path using C#.net

C#
string sPath;
sPath = Path.GetTempPath();
Console.WriteLine("Temporary Path := " + sPath );


Thanks,
Imdadhusen
 
Share this answer
 
Comments
Manfred Rudolf Bihy 1-Jun-12 6:03am    
Nice one! 5+
Since .NET is .NET regardless of the language used you can use any .NET DLL in any .NET language (as long as the .NET versions are compatible that is). So you'll just have to add a reference to the Microsoft.VisualBasic.dll to your project and add a using clause to your code:
C#
using Microsoft.VisualBasic.FileIO;


Now you are ready to use the SpecialDirectories Class[^] from your C# code.

Regards,

Manfred
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900