-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

C# 6 and .NET Core 1.0

In Chapter 7, Implementing Interfaces and Inheriting Classes, you learned how to create your own extension methods. To create LINQ extension methods, all you have to do is extend the IEnumerable<T>
type.
Add a new Class Library project named Ch09_MyLINQExtensions. Rename the Class1.cs
file to MyLINQExtensions
.
Modify the class to look like the following code. Note that the ProcessSequence
extension method doesn't actually modify the sequence because it exists only as an example. It would be up to you to process the sequence in whatever manner you want. The SummariseSequence
extension method also doesn't do anything especially useful. It simply returns the number of items in the sequence by using the built-in LongCount
extension method. Again, it would be up to you to decide exactly what this method should do and what type it should return:
using System.Collections.Generic; namespace System.Linq { public static class MyLINQExtensions {...
Change the font size
Change margin width
Change background colour