Book Image

Cross-platform UI Development with Xamarin.Forms

By : Paul Johnson
Book Image

Cross-platform UI Development with Xamarin.Forms

By: Paul Johnson

Overview of this book

Table of Contents (22 chapters)
Cross-platform UI Development with Xamarin.Forms
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
In the Beginning…
Index

Too much information!


Using * within the SQL query has an unfortunate drawback. It retrieves everything based on the parameters passed into the query. This could mean hundreds of objects returned to List.

As previously discussed, help is at hand. That help is in the form of LINQ.

Getting Linq'd

It should become apparent that LINQ is a powerful addition to the programmer's arsenal. To quote the grandfather of telesales, Billy Mays—but wait, there's more!

Finding data with LINQ

There are six ways of finding data within a collection:

  • Where

  • First and FirstOrDefault

  • Single and SingleOrDefault

  • Select

  • SelectMany

  • Last and LastOrDefault

Where

Where allows searching a collection based on any parameter within the collection. This will result in List<T> or IEnumerable<T>. If .ToList() is omitted, IEnumerable is generated:

var demoList = otherList.Where(t=>t.something == "foo");
var demoList = otherList.Where(t=>t.something == "foo").ToList();

First and FirstOrDefault

These two LINQ methods...