I am used to developing in a certain language. After a long time, many people may reject or conflict with other languages. In fact!
For example, you may often see someone asking"How can I ping the website using C?", Search in the garden: [C # ping operation] This is a comprehensive summary, but in fact... if you want to temporarily exit from the world of C # and look around, the method is simpler:
First Add a reference to Microsoft. VisualBasic, and then refer to the followingCode:
... Using Microsoft. visualBasic. devices ;... computer mycomputer = new computer (); Boolean Ping = mycomputer. network. ping ("www.cnblogs.com"); If (PING) {response. write ("your machine can go to the blog Park! ");} Else {response. Write (" the blog site cannot be accessed! ");}
For example:How to use C # To Simplify Chinese characters <--> traditional conversion?
Using Microsoft. VisualBasic;... response. Write (strings. strconv ("Yang Guo under the bodhi tree", vbstrconv. traditionalchinese, 0 ));
In this way, the simplified Chinese is changed to traditional Chinese, similar:
Response. Write (strings. strconv ("", vbstrconv. simplifiedchinese, 0 ));
In this way, you can convert traditional Chinese to simplified Chinese
How to obtain the current webapplication'sProgramSet Name to runtime directory?
Using system; using Microsoft. visualBasic. applicationservices; namespace aspxwebform {public partial class webform1: system. web. UI. page {protected void page_load (Object sender, eventargs e) {applicationbase APP = new applicationbase (); response. write ("<br/> Assembly name:" + app. info. assemblyname); response. write ("<br/> directory where the Assembly runs:" + app. info. directorypath );}}}
How do I search for files in a directory and Its subdirectories that contain 'abc?
Using system; using Microsoft. visualBasic. devices; using Microsoft. visualBasic. fileio; namespace aspxwebform {public partial class webform1: system. web. UI. page {protected void page_load (Object sender, eventargs e) {computer mycomputer = new computer (); var list = mycomputer. filesystem. findinfiles ("C: \ temp \", "ABC", true, searchoption. searchallsubdirectories); foreach (VAR item in list) {response. write (item + "<br/> ");}}}}
The above code will search for c: \ Temp files containing "ABC" in all subdirectories (Case Insensitive)
The several small applications listed in this article can only be regarded as an example. If you find that VB. NET is more fun and concise, you are welcome to reply.