Data Structures

Many of you have dealt with data structures when working with other programming languages. Whenever it's necessary to access information via a standard interface, structures are a good choice. Structures are pretty similar to objects. However, there are also major differences that make it hard to compare structures with objects. Structures are also known as value types.

Implementing Structures

Let's see how structures can be implemented. The target of the next example is to implement a data structure that can store a variety of variables:

 using System; public struct Product { public string name; public double price; } public class Demo { public static void Main() { Product book = new Product(); book.name = "GNU Mono"; book.price ...

Get Mono Kick Start now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.