SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 441 | Next

Scott Klein

"Professional LINQ"


For example, you can do the following:
var query =
(from c in contact
where c.FirstName.StartsWith("S")
&& c.LastName.StartsWith("K")
orderby c.LastName
select c);
dataGrid1.DataSource = query;
Likewise, you can bind data to a data source as follows (given the same query):
BindingSource bindsrc = new BindingSource();
bindsrc.DataSource = query;
dataGrid1.DataSource = bndsrc;
Implicit binding is available due to the fact that the Table and DataQuery classes have been
updated to implement the IListSource interface.
Comparing DataRows
The last topic to be discussed in this chapter is the ability to use LINQ to DataSet to compare rows. As you
learned in the early chapters of this book, LINQ provides several operators??”Distinct, Union, Intersect,
and Except??”that provide comparison capabilities. These set operators compare source elements,
checking for equality.
Elements can be compared for equality by calling the operators??™ GetHashCode and Equals methods.
However, one of the things added to LINQ to DataSet is the DataRowComparer class.


Pages:
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6