Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
System.IO Namespace
Path Class
 Path Members
Collapse All/Expand All Collapse All
Members FilterMembers Filter
Frameworks FilterFrameworks Filter
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Path Members

Performs operations on String instances that contain file or directory path information. These operations are performed in a cross-platform manner.

The Path type exposes the following members.

  NameDescription
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkChangeExtensionChanges the extension of a path string.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkCombineCombines two path strings.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetDirectoryNameReturns the directory information for the specified path string.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetExtensionReturns the extension of the specified path string.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetFileNameReturns the file name and extension of the specified path string.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetFileNameWithoutExtensionReturns the file name of the specified path string without the extension.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetFullPathReturns the absolute path for the specified path string.
Public methodStatic memberGetInvalidFileNameCharsGets an array containing the characters that are not allowed in file names.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetInvalidPathCharsGets an array containing the characters that are not allowed in path names.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkGetPathRootGets the root directory information of the specified path.
Public methodStatic memberGetRandomFileNameReturns a random folder name or file name.
Public methodStatic memberSupported by the .NET Compact FrameworkGetTempFileNameCreates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.
Public methodStatic memberSupported by the .NET Compact FrameworkGetTempPathReturns the path of the current system's temporary folder.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkHasExtensionDetermines whether a path includes a file name extension.
Public methodStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkIsPathRootedGets a value indicating whether the specified path string contains absolute or relative path information.
Top
  NameDescription
Public fieldStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkAltDirectorySeparatorCharProvides a platform-specific alternate character used to separate directory levels in a path string that reflects a hierarchical file system organization.
Public fieldStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkDirectorySeparatorCharProvides a platform-specific character used to separate directory levels in a path string that reflects a hierarchical file system organization.
Public fieldStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkInvalidPathChars Obsolete. Provides a platform-specific array of characters that cannot be specified in path string arguments passed to members of the Path class.
Public fieldStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkPathSeparatorA platform-specific separator character used to separate path strings in environment variables.
Public fieldStatic memberSupported by the .NET Compact FrameworkSupported by the XNA FrameworkVolumeSeparatorCharProvides a platform-specific volume separator character.
Top
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
New Method Request: GetShortestRelativePath      Ron A Inbar   |   Edit   |   Show History
Syntax:

public static string GetShortestRelativePath(
string path,
string baseDirectory
)

Parameters:

path

A path (either rooted or relative to the current directory) to some file or directory.

baseDirectory

A path (either rooted or relative to the current directory) to some directory.

Return Value:

The shortest relative path from baseDirectory to path.

Exceptions:

ArgumentException

path is on a different volume than baseDirectory.


New Method Request - GetFolderName      New Method Request - GetFolderName   |   Edit   |   Show History
Syntax:

public static string GetFolderName(
string path)

Parameters:

path

A path (either rooted or relative to the current directory) to some file or directory.

Return Value:

The name of folder.

Implementation

return Path

.GetFullPath(path).Replace(Path.GetDirectoryName(path),string.Empty ).Replace(Path.DirectorySeparatorChar.ToString() ,string.Empty ) ;
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker