---
title: "how to use structure in c#"  
description: "how to use structure in c#"  
author: "Anonymous User"  
published: 2015-12-07  
updated: 2015-12-07  
canonical: https://www.mindstick.com/forum/33692/how-to-use-structure-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# how to use structure in c#

I want to use [Structure in c#](https://answers.mindstick.com/qa/82427/what-is-structure-in-c-sharp) please Help me.

## Replies

### Reply by Anonymous User

You have already used a simple [structure](https://www.mindstick.com/articles/23258/choose-your-business-structure-wisely) named Books. Structures in C# are quite different from that in traditional C or C++. The C# structures have the following features:

Structures can have methods, fields, indexers, properties, operator methods, and events.

Structures can have defined constructors, but not destructors. However, you cannot define a default constructor for a structure. The default constructor is automatically defined and cannot be changed.

Unlike classes, structures cannot inherit other structures or classes.

Structures cannot be used as a base for other structures or classes.

A structure can implement one or more interfaces.

Structure members cannot be specified as abstract, virtual, or protected.

When you create a struct object using the New operator, it gets created and the appropriate constructor is called. Unlike classes, structs can be instantiated without using the New operator.

If the New operator is not used, the fields remain unassigned and the object cannot be used until all the fields are initialized.

```
using System;struct Books{    public string Title;    public string AuthorName;    public string Subject;    public int BookID;};public class Structure{    public static void Main(string[] args)    {        Books Book1;           Books Book2;            Book1.Title = "C Programming";        Book1.AuthorName = "Raju Ali";        Book1.Subject = "C Programming Tutorial";        Book1.BookID = 145889501;              Book2.Title = "Java Programming";        Book2.AuthorName = "Aditya singh";        Book2.Subject = "Java Programming Tutorial";        Book2.BookID = 145879001;               Console.WriteLine("Book 1 title : {0}", Book1.Title);        Console.WriteLine("Book 1 author : {0}", Book1.AuthorName);        Console.WriteLine("Book 1 subject : {0}", Book1.Subject);        Console.WriteLine("Book 1 book_id :{0}", Book1.BookID);            Console.WriteLine("Book 2 title : {0}", Book2.Title);        Console.WriteLine("Book 2 author : {0}", Book2.AuthorName);        Console.WriteLine("Book 2 subject : {0}", Book2.Subject);        Console.WriteLine("Book 2 book_id : {0}", Book2.BookID);        Console.ReadKey();    }}
```

![how to use structure in c#](https://www.mindstick.com/mindstickforums/e20dbdb3-f108-4bbd-9e9b-4fcf55b072ae/images/bcf71024-2a5d-4fd3-9dbf-0dee7954e3a7.png)


---

Original Source: https://www.mindstick.com/forum/33692/how-to-use-structure-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
