Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the correct use of try.dot.net?

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

What is the correct use of try.dot.net, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

[introduction]

Microsoft officially released try.dot.net this interesting website not long ago. At first, I just took a fresh look at it. Later, through my own practice, I found that this is really an "interesting" site!

Next, let's introduce how to use this interesting tool through an experience of our own.

[implementation process] 1. Go to the official introduction website of try.dot.net to learn how to use try.dot.net

We can easily understand the instructions for using try.dot.net through the github project address and Microsoft release notes provided by Microsoft. A link is provided here:

GitHub address: https://github.com/dotnet/try

Official introduction address: https://dotnet.microsoft.com/platform/try-dotnet

From the introduction website, you can see the classic usage:

Display code snippets through iframe nesting to your own URL. Unfortunately, I am still stuck in the stage of iframe cross-domain rejection / cry manually (after working all night, I still can't figure out how to solve the iframe cross-domain URL. If you have a message, you can leave a message and give it to a demo.)

From the iframe address above, you can see that when try.dot.net displays the code snippet, it is linked through the gist code snippet id.

The use of 2.gist

Gist is an additional feature of github that allows multiple code snippets to be stored on the site, where an id is automatically generated for the code snippet, and id references can be used elsewhere.

First, you need to log in to the site of gist: https://gist.github.com

There may be people who can access github but not this site (such as me). Here is a solution:

Configure hosts (not Baidu): 192.30.253.118 gist.github.com

Then you can log in to this site.

The interface is very simple, directly enter the file name and related code points in the lower right corner of the save. AddFile can add another piece of code.

Write a random entity class and put it here:

After saving, click on the class file just now, and you can see that the url of the browser looks like this:

Https://gist.github.com/sevenTiny/98b8b484dd9d0fbf8bd1bac0425db914

The id of the code snippet has been generated.

Next we will copy the id to debug our code snippet with try.dot.net.

Integration of 3.try.dot.net

Copy the id above, and then replace the fromGist in the try.dot.net demo to get your own snippet address.

Https://try.dot.net/?fromGist=98b8b484dd9d0fbf8bd1bac0425db914

We can visit.

The code works well and the result is correct!

So the question is, some people say that mine is also operated in this way, why does the code not appear after accessing the address? The code area is blank.

I also encountered this situation at first. After comparing the official code snippet with Microsoft, I found that there was only a lack of Main method, so I added a program fragment with Main method, and then the problem was solved and the code appeared successfully!

Guess that the Microsoft try.dot.net imitates a console application, and it must have the Main method of the console application to run.

You must provide a code snippet with the Main method

The running try.dot.net interface can only display this code snippet, other code snippets will not be displayed, but can be referenced and used.

[expansion]

By doing this, we have learned how to display and run our code snippets using try.dot.net, so we can inspire a little curiosity about how Microsoft makes code hints in the front-end interface.

We open browser F12 to view the request information, and then enter a piece of code

You can clearly see that each time you enter a character, the site requests to analyze the current code, then returns a code snippet that might be prompted, and a code prompt box pops up.

The principle is quite intuitive.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report