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

How to use C # structure

2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "how to use the C# structure". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Example

Using System

Using System.Text

Struct Books

{

Public string title

Public string author

Public string subject

Public int book_id

}

Public class testStructure

{

Public static void Main (string [] args)

{

Books Book1; / * declares Book1 with type Books * /

Books Book2; / * declares Book2 with type Books * /

/ * book 1 details * /

Book1.title = "C Programming"

Book1.author = "Nuha Ali"

Book1.subject = "C Programming Tutorial"

Book1.book_id = 6495407

/ * book 2 details * /

Book2.title = "Telecom Billing"

Book2.author = "Zara Ali"

Book2.subject = "Telecom Billing Tutorial"

Book2.book_id = 6495700

/ * print Book1 information * /

Console.WriteLine ("Book1 title: {0}", Book1.title)

Console.WriteLine ("Book1 author: {0}", Book1.author)

Console.WriteLine ("Book1 subject: {0}", Book1.subject)

Console.WriteLine ("Book1 book_id: {0}", Book1.book_id)

/ * print Book2 information * /

Console.WriteLine ("Book2 title: {0}", Book2.title)

Console.WriteLine ("Book2 author: {0}", Book2.author)

Console.WriteLine ("Book2 subject: {0}", Book2.subject)

Console.WriteLine ("Book2 book_id: {0}", Book2.book_id)

Console.ReadKey ()

}

}

When the above code is compiled and executed, it produces the following results:

Book 1 title: C ProgrammingBook 1 author: Nuha AliBook 1 subject: C Programming TutorialBook 1 book_id: 6495407Book 2 title: Telecom BillingBook 2 author: Zara AliBook 2 subject: Telecom Billing TutorialBook 2 book_id: 6495700 "how to use the C # structure", thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Development

Wechat

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

12
Report