Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Beginning C# 7 Hands-On ??? Advanced Language Features

You're reading from   Beginning C# 7 Hands-On ??? Advanced Language Features Learn the advanced-level features of C# 7 using Visual Studio 2017

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781788294263
Length 310 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Tom Owsiak Tom Owsiak
Author Profile Icon Tom Owsiak
Tom Owsiak
Arrow right icon
View More author details
Toc

Table of Contents (30) Chapters Close

Preface 1. Creating a Simple Generics Class 2. Creating a Generic Method FREE CHAPTER 3. Implementing a Generic Interface to Accomplish Sorting 4. Making Delegates More Flexible with Generics 5. Creating and Using Generic Dictionaries 6. Connection Between Delegates and Lambda Expressions 7. Expression-Bodied Lambdas and Expression-Bodied Members 8. Anonymous Methods and Objects That Run Their Own Delegates 9. C# with LINQ and Built-In Types 10. C# with LINQ and Custom Data Types 11. Using Query Syntax to Construct Queries 12. Queries That Perform Aggregation Functions 13. Using LINQ to Summarize Tuples 14. Summarizing Results with Grouping 15. Joining Datasets with Inner Joins 16. Downloading, Installing, and Running SQL Server 2017 17. Writing Code to Manually Connect to a Table and Retrieve Records 18. Inserting Records into Tables Using Stored Procedures 19. Using the Nullable Feature to Make Apps More Stable 20. Connecting a Chart Control to SQL Server 21. Using LINQ to Operate on Tables from SQL Server 22. Creating a Page That Saves Text to Disk 23. Creating a Page That Uses the File Upload Control 24. Serializing and Deserializing Objects 25. Having a Little Fun with Images with Pixel Manipulations 26. Saving an Image to SQL Server 27. Creating and Using an XML File 28. Creating XML Files with C# 29. Querying XML Documents with LINQ

Introducing tuples

Now, first we will make a function that returns tuple values. So, what is a tuple? Let's define them. As I said earlier, it's basically a collection of several values. Now, in C#, this means that you'll enter the following below the closed curly brace under the line that begins with public partial class...:

private static Tuple<double, double, double, double> SummarizeList(List<double> listDoubles)

In the preceding line, Tuple is a class. Then, to define the number of values that the tuple stores, remember our work with vectors. We did two or three values to a vector. This is a similar concept. If you hover your mouse over Tuple, it says that Tuple represents n-tuple where n is eight or greater, so T1, T2, T3, up to TRest. Wow, so you can make eight or more tuples!

...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime