Book Image

Learn C# in 7 days

By : Gaurav Aroraa
1 (1)
Book Image

Learn C# in 7 days

1 (1)
By: Gaurav Aroraa

Overview of this book

This book takes a unique approach to teach C# to absolute beginners. You’ll learn the basics of the language in seven days. It takes a practical approach to explain the important concepts that build the foundation of the C# programming language. The book begins by teaching you the basic fundamentals using real-world practical examples and gets you acquainted with C# programming. We cover some important features and nuances of the language in a hands-on way, helping you grasp the concepts in a fluid manner. Later, you’ll explore the concepts of Object-Oriented Programming (OOP) through a real-world example. Then we dive into advanced-level concepts such as generics and collections, and you’ll get acquainted with objects and LINQ. Towards the end, you’ll build an application that covers all the concepts explained in the book. By the end of this book, you will have next-level skills and a good knowledge of the fundamentals of C#.
Table of Contents (15 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Playing with collections and generics


Collections are not new for us, as we went through and discussed non-generic collections on day five. So, we also have generic collections. In this section, we will discuss all about collections and generics with the use of code examples.

Understanding collection classes and their usage

As discussed on day five, collection classes are specialized classes and are meant for data interaction (storage and retrieval). We have already discussed various collection classes, namely stacks, queues, lists, and hash tables, and we have written code using the System.Collections.NonGeneric namespace. The following table provides us an overview of the usage and meaning of non-generic collection classes:

Property

Description

Usage

ArrayList

The name itself describes that this contains a collection of ordered collection that can be accessed using index.

We can declare ArrayList as follows:ArrayList arrayList = new ArrayList();

On day two, we discussed arrays and went through...