Bill Blogs in C#

Bill Wagner discusses C#, LINQ, and other items of interest

Excerpts of “More Effective C#” posted on InformIT

Three different items from More Effective C# have been posted publicly on the InformIT site:

Item 36:  Understand how Query Expressions Map to Method Calls.

Linq is built on two concepts: A query language and a translation from that query language to a set of methods.”

Item 44: Prefer Storing Expression<> to Func<>

If your type will be storing expressions, passing those expressions to other objects not under your control, or if you will be composing expressions into more complex constructs, consider using expressions instead of func. You’ll have a richer set of APIs that will enable you to modify those expressions at runtime, and invoke them after you have examined them for your own internal purposes.

Item 13: Use lock() as your First Choice for Synchronization.

Threads need to communicate with each other. Somehow, you need to provide a safe way for different threads in your application to send and receive data with each other. However, sharing data between threads introduces the potential for data integrity errors in form of synchronization issues. Somehow you need to be certain that the current state of every shared data item is consistent. You achieve this safety by using synchronization primitives to protect access to the shared data. Synchronization primitives ensure that the current thread will not be interrupted until a critical set of operations is completed.

It will give you a taste of the rest of the book.

I hope you enjoy it.

Published Wed, Oct 22 2008 8:58 PM by wwagner