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

Hands-on exercises


Answer the following questions, which cover the concepts of today's learning:

  1. What are ValueTuple types?
  2. ValueTuples are mutable; prove with an example.
  3. Create a ValueTuple of 10 elements.
  1. Create a user-defined class employee as follows and then write a program to deconstruct user-defined types:
public class employee
{
public Guid EmplId { get; set; }
public String First { get; set; }
public string Last { get; set; }
public char Sex { get; set; }
public string DepartmentId { get; set; }
public string Designation { get; set; }
}
  1. Create a class of various constants using digit separators and implement these constants to a function ToDecimal() and ToBinary().
  2. What are local functions? How are they different from private functions?
  3. Rewrite the OddEven program using generic local functions.
  4. Rewrite the OddEven program using the type pattern in switch case.
  5. Write a program to find out OddEven with the utilization of inferred Tuple names feature of language C# 7.1.
  6. What is default expression...