Several methods and functions that are easy to ignore but important in ASP. NET are introduced.

Source: Internet
Author: User

We will introduce several methods of the Path class in. NET:

1. Path. combine (string, string)
Returns a path based on the given two paths.
For example:
String CompletePath = System. IO. Path. Combine (@ "c: \ MyApp", @ "Images \ skyline.jpg ");
A full path c: \ MyApp \ Images \ skyline.jpg will be returned.
The first parameter can end.

2. Path. GetExtension (string)
Returns the extension of the given file path. For example:
String FileExtention = System. IO. Path. GetExtention (@ "C: \ MyApp \ Images \ skyline.jpg ");
Will return "jpg"

3. Path. GetFileName (string)
Give the full path of the file name, and return the file name (including the extension). For example:
String fileName = System. IO. Path. GetFileName (@ "c: \ MyApp \ Images \ skyline.jpg ");
"Skyline.jpg" is returned"

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.