Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the structure of C #

Shulou Source: shulou.com Published: 2022-06-02 18:41:33 09月12日 Update

Editor to share with you how to use the structure of C#, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

The structural user program of C#:

Public struct content {string title; string author; string contentcontent; string url;}

However, it is found that after instantiating content:

Content ok=new content ()

Unable to get title and so on through ok

Then I suddenly remembered that I need to set the internal element title and so on to public, otherwise C# will default to private, so change the code to:

The structural user program of C#:

Public struct content {public string title; public string author; public string contentcontent; public string url;}

The structure of C # is used to solve the problem.

The above is all the contents of the article "how to use the structure of C#". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Caching structure articles content programs not much code elements most examples more knowledge industry information information channels questions channels references learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Huawei Shulou Technology vpn Docker