In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shares with you the content of a sample analysis of VB.NET file objects. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
VB.NET is a language based on. Net framework SDK released by Microsoft. It has the same application mechanism as Java, can achieve code hosting, and has powerful object-oriented features. Below, we can make a detailed interpretation of the language through the introduction of VB.NET file objects.
The VB.NET file object represents a file, and there are some very useful ways to verify the existence of a file and to rename and delete a file. For example:
Dim fl as File fl=new File ("foo.txt") if (fl.Exists)'if the file exists fl.Delete 'delete it End If
Users can also use the File object to get a FileStream object, and then read and write file data by using the FileStream object:
Dim ts as TextStream Dim fs as FileStream ts=fl.OpenText 'open a text file for reading fs=fl.OpenRead' open any file for reading
(1) VB.NET file object reads a text file (TextFile)
To read a text file, the user can use the File object to get a StreamReader object, and then use the text stream (text stream) reading method:
Dim ts as StreamReader ts=fl.OpenText () s=ts.readLine
(2) VB.NET file object to write a text file (Write a Text File)
To create and write a text file, the user can get a StreamWrite object using the CreateText method, and then perform operations, such as:
Dim sw as streamWriter sw=fl.CreateText sw.writeLine ("write text into file")
If you want to operate on an existing file, you can use an object with logical parameters to do so:
Sw=new StreamWriter (path,true) Thank you for your reading! This is the end of this article on "sample Analysis of VB.NET File objects". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.